[PATCH] nfsd4: return better error on io incompatible with open mode
authorNeilBrown <neilb@cse.unsw.edu.au>
Fri, 8 Jul 2005 00:59:23 +0000 (17:59 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 8 Jul 2005 01:24:09 +0000 (18:24 -0700)
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: Andy Adamson <andros@citi.umich.edu>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/nfsd/nfs4state.c
include/linux/nfsd/nfsd.h

index b96714ae3dd79412f670c2a76b339b8bb5b930b4..3647c942915ed686981705cc069206549800c702 100644 (file)
@@ -1295,7 +1295,7 @@ nfs4_share_conflict(struct svc_fh *current_fh, unsigned int deny_type)
        fp = find_file(ino);
        if (!fp)
                return nfs_ok;
-       ret = nfserr_share_denied;
+       ret = nfserr_locked;
        /* Search for conflicting share reservations */
        list_for_each_entry(stp, &fp->fi_stateids, st_perfile) {
                if (test_bit(deny_type, &stp->st_deny_bmap) ||
index c2da1b62d416fd563e49d9c6e269a7e71b12d1d8..6d5a24f3fc6d902aad24b9c532d15dec3a863da1 100644 (file)
@@ -231,6 +231,7 @@ void                nfsd_lockd_shutdown(void);
 #define        nfserr_reclaim_bad      __constant_htonl(NFSERR_RECLAIM_BAD)
 #define        nfserr_badname          __constant_htonl(NFSERR_BADNAME)
 #define        nfserr_cb_path_down     __constant_htonl(NFSERR_CB_PATH_DOWN)
+#define        nfserr_locked           __constant_htonl(NFSERR_LOCKED)
 
 /* error codes for internal use */
 /* if a request fails due to kmalloc failure, it gets dropped.