[PATCH] knfsd: nfsd4: fix open flag passing
authorJ. Bruce Fields <bfields@citi.umich.edu>
Fri, 30 Jun 2006 08:56:17 +0000 (01:56 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 30 Jun 2006 18:25:40 +0000 (11:25 -0700)
Since nfsv4 actually keeps around the file descriptors it gets from open
(instead of just using them for a single read or write operation), we need to
make sure that we can do RDWR opens and not just RDONLY/WRONLY.

Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
fs/nfsd/nfs4state.c
fs/nfsd/vfs.c

index 591dc6ba6e19769fb128583ee1075c0bb586ffcf..9daa0b9feb8d027e438ef39c846daee95cf2d6cf 100644 (file)
@@ -1790,10 +1790,10 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
        } else {
                /* Stateid was not found, this is a new OPEN */
                int flags = 0;
+               if (open->op_share_access & NFS4_SHARE_ACCESS_READ)
+                       flags |= MAY_READ;
                if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
-                       flags = MAY_WRITE;
-               else
-                       flags = MAY_READ;
+                       flags |= MAY_WRITE;
                status = nfs4_new_open(rqstp, &stp, dp, current_fh, flags);
                if (status)
                        goto out;
index f916b170e136bd4c764b243bef1c4d013e1700e9..423e1ba070442797f65ce9da1ac0ebdbf16b9306 100644 (file)
@@ -673,7 +673,10 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
                goto out_nfserr;
 
        if (access & MAY_WRITE) {
-               flags = O_WRONLY|O_LARGEFILE;
+               if (access & MAY_READ)
+                       flags = O_RDWR|O_LARGEFILE;
+               else
+                       flags = O_WRONLY|O_LARGEFILE;
 
                DQUOT_INIT(inode);
        }