Commit 9ecb6a08 authored by J. Bruce Fields's avatar J. Bruce Fields Committed by Linus Torvalds

[PATCH] knfsd: nfsd4: fix open flag passing

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: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: default avatarNeil Brown <neilb@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent ba5a6a19
...@@ -1790,10 +1790,10 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf ...@@ -1790,10 +1790,10 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
} else { } else {
/* Stateid was not found, this is a new OPEN */ /* Stateid was not found, this is a new OPEN */
int flags = 0; int flags = 0;
if (open->op_share_access & NFS4_SHARE_ACCESS_READ)
flags |= MAY_READ;
if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE) if (open->op_share_access & NFS4_SHARE_ACCESS_WRITE)
flags = MAY_WRITE; flags |= MAY_WRITE;
else
flags = MAY_READ;
status = nfs4_new_open(rqstp, &stp, dp, current_fh, flags); status = nfs4_new_open(rqstp, &stp, dp, current_fh, flags);
if (status) if (status)
goto out; goto out;
......
...@@ -673,6 +673,9 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type, ...@@ -673,6 +673,9 @@ nfsd_open(struct svc_rqst *rqstp, struct svc_fh *fhp, int type,
goto out_nfserr; goto out_nfserr;
if (access & MAY_WRITE) { if (access & MAY_WRITE) {
if (access & MAY_READ)
flags = O_RDWR|O_LARGEFILE;
else
flags = O_WRONLY|O_LARGEFILE; flags = O_WRONLY|O_LARGEFILE;
DQUOT_INIT(inode); DQUOT_INIT(inode);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment