Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b700949b authored by NeilBrown's avatar NeilBrown Committed by Linus Torvalds
Browse files

[PATCH] nfsd4: return better error on io incompatible with open mode



from RFC 3530:
"Share reservations are established by OPEN operations and by their
nature are mandatory in that when the OPEN denies READ or WRITE
operations, that denial results in such operations being rejected
with error NFS4ERR_LOCKED."

(Note that share_denied is really only a legal error for OPEN.)

Signed-off-by: default avatarAndy Adamson <andros@citi.umich.edu>
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: default avatarNeil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 444c2c07
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -1295,7 +1295,7 @@ nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type)
	fp = find_file(ino);
	fp = find_file(ino);
	if (!fp)
	if (!fp)
		return nfs_ok;
		return nfs_ok;
	ret = nfserr_share_denied;
	ret = nfserr_locked;
	/* Search for conflicting share reservations */
	/* Search for conflicting share reservations */
	list_for_each_entry(stp, &fp->fi_stateids, st_perfile) {
	list_for_each_entry(stp, &fp->fi_stateids, st_perfile) {
		if (test_bit(deny_type, &stp->st_deny_bmap) ||
		if (test_bit(deny_type, &stp->st_deny_bmap) ||
+1 −0
Original line number Original line Diff line number Diff line
@@ -231,6 +231,7 @@ void nfsd_lockd_shutdown(void);
#define	nfserr_reclaim_bad	__constant_htonl(NFSERR_RECLAIM_BAD)
#define	nfserr_reclaim_bad	__constant_htonl(NFSERR_RECLAIM_BAD)
#define	nfserr_badname		__constant_htonl(NFSERR_BADNAME)
#define	nfserr_badname		__constant_htonl(NFSERR_BADNAME)
#define	nfserr_cb_path_down	__constant_htonl(NFSERR_CB_PATH_DOWN)
#define	nfserr_cb_path_down	__constant_htonl(NFSERR_CB_PATH_DOWN)
#define	nfserr_locked		__constant_htonl(NFSERR_LOCKED)


/* error codes for internal use */
/* error codes for internal use */
/* if a request fails due to kmalloc failure, it gets dropped.
/* if a request fails due to kmalloc failure, it gets dropped.