aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorWeston Andros Adamson <dros@netapp.com>2012-10-02 17:49:51 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2012-10-02 17:55:41 -0400
commitbbd3a8eee82a2a6f4aa1cce60ccb014f25e5c560 (patch)
treeb8fb68e90af256e20bb25454a3574326c9824dae /fs/nfs
parentddfc4e171292d63d7e3f8c95ff9c3ef9932870ce (diff)
NFSv4: don't check MAY_WRITE access bit in OPEN
Don't check MAY_WRITE as a newly created file may not have write mode bits, but POSIX allows the creating process to write regardless. This is ok because NFSv4 OPEN ops handle write permissions correctly - the ACCESS in the OPEN compound is to differentiate READ v EXEC permissions. Fixes a regression due to commit 6168f62c (NFSv4: Add ACCESS operation to OPEN compound) Signed-off-by: Weston Andros Adamson <dros@netapp.com> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/nfs4proc.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 1e0faf9fa078..ccada6856f0d 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1661,10 +1661,10 @@ static int nfs4_opendata_access(struct rpc_cred *cred,
1661 return 0; 1661 return 0;
1662 1662
1663 mask = 0; 1663 mask = 0;
1664 /* don't check MAY_WRITE - a newly created file may not have
1665 * write mode bits, but POSIX allows the creating process to write */
1664 if (fmode & FMODE_READ) 1666 if (fmode & FMODE_READ)
1665 mask |= MAY_READ; 1667 mask |= MAY_READ;
1666 if (fmode & FMODE_WRITE)
1667 mask |= MAY_WRITE;
1668 if (fmode & FMODE_EXEC) 1668 if (fmode & FMODE_EXEC)
1669 mask |= MAY_EXEC; 1669 mask |= MAY_EXEC;
1670 1670
@@ -1673,7 +1673,7 @@ static int nfs4_opendata_access(struct rpc_cred *cred,
1673 nfs_access_set_mask(&cache, opendata->o_res.access_result); 1673 nfs_access_set_mask(&cache, opendata->o_res.access_result);
1674 nfs_access_add_cache(state->inode, &cache); 1674 nfs_access_add_cache(state->inode, &cache);
1675 1675
1676 if ((mask & ~cache.mask & (MAY_READ | MAY_WRITE | MAY_EXEC)) == 0) 1676 if ((mask & ~cache.mask & (MAY_READ | MAY_EXEC)) == 0)
1677 return 0; 1677 return 0;
1678 1678
1679 /* even though OPEN succeeded, access is denied. Close the file */ 1679 /* even though OPEN succeeded, access is denied. Close the file */