NFSv4: Fix access mode checking when opening a delegated file. Signed-off-by: Trond Myklebust --- nfs4proc.c | 10 +++++++--- 1 files changed, 7 insertions(+), 3 deletions(-) Index: linux-2.6.11/fs/nfs/nfs4proc.c =================================================================== --- linux-2.6.11.orig/fs/nfs/nfs4proc.c +++ linux-2.6.11/fs/nfs/nfs4proc.c @@ -357,11 +357,16 @@ static int _nfs4_proc_open_confirm(struc return status; } -static int _nfs4_do_access(struct inode *inode, struct rpc_cred *cred, int mask) +static int _nfs4_do_access(struct inode *inode, struct rpc_cred *cred, int openflags) { struct nfs_access_entry cache; + int mask = 0; int status; + if (openflags & FMODE_READ) + mask |= MAY_READ; + if (openflags & FMODE_WRITE) + mask |= MAY_WRITE; status = nfs_access_get_cached(inode, cred, &cache); if (status == 0) goto out; @@ -392,7 +397,6 @@ static int _nfs4_open_delegated(struct i struct nfs4_state_owner *sp = NULL; struct nfs4_state *state = NULL; int open_flags = flags & (FMODE_READ|FMODE_WRITE); - int mask = 0; int err; /* Protect against reboot recovery - NOTE ORDER! */ @@ -426,7 +430,7 @@ static int _nfs4_open_delegated(struct i goto out_err; lock_kernel(); - err = _nfs4_do_access(inode, cred, mask); + err = _nfs4_do_access(inode, cred, open_flags); unlock_kernel(); if (err != 0) goto out_err;