aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/vfs.c
diff options
context:
space:
mode:
authorNeil Brown <neilb@suse.de>2012-12-07 15:40:55 -0500
committerJ. Bruce Fields <bfields@redhat.com>2012-12-10 16:25:31 -0500
commit7007c90fb9fef593b4aeaeee57e6a6754276c97c (patch)
tree8fe1b5daa2132876b364801aaef4127774c6c4b3 /fs/nfsd/vfs.c
parent756933ee8a75970ca7d8a10e922f5d44720457a4 (diff)
nfsd: avoid permission checks on EXCLUSIVE_CREATE replay
With NFSv4, if we create a file then open it we explicit avoid checking the permissions on the file during the open because the fact that we created it ensures we should be allow to open it (the create and the open should appear to be a single operation). However if the reply to an EXCLUSIVE create gets lots and the client resends the create, the current code will perform the permission check - because it doesn't realise that it did the open already.. This patch should fix this. Note that I haven't actually seen this cause a problem. I was just looking at the code trying to figure out a different EXCLUSIVE open related issue, and this looked wrong. (Fix confirmed with pynfs 4.0 test OPEN4--bfields) Cc: stable@kernel.org Signed-off-by: NeilBrown <neilb@suse.de> [bfields: use OWNER_OVERRIDE and update for 4.1] Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/vfs.c')
-rw-r--r--fs/nfsd/vfs.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/nfsd/vfs.c b/fs/nfsd/vfs.c
index b584205b25b4..0ef9b6b410a2 100644
--- a/fs/nfsd/vfs.c
+++ b/fs/nfsd/vfs.c
@@ -1471,13 +1471,19 @@ do_nfsd_create(struct svc_rqst *rqstp, struct svc_fh *fhp,
1471 case NFS3_CREATE_EXCLUSIVE: 1471 case NFS3_CREATE_EXCLUSIVE:
1472 if ( dchild->d_inode->i_mtime.tv_sec == v_mtime 1472 if ( dchild->d_inode->i_mtime.tv_sec == v_mtime
1473 && dchild->d_inode->i_atime.tv_sec == v_atime 1473 && dchild->d_inode->i_atime.tv_sec == v_atime
1474 && dchild->d_inode->i_size == 0 ) 1474 && dchild->d_inode->i_size == 0 ) {
1475 if (created)
1476 *created = 1;
1475 break; 1477 break;
1478 }
1476 case NFS4_CREATE_EXCLUSIVE4_1: 1479 case NFS4_CREATE_EXCLUSIVE4_1:
1477 if ( dchild->d_inode->i_mtime.tv_sec == v_mtime 1480 if ( dchild->d_inode->i_mtime.tv_sec == v_mtime
1478 && dchild->d_inode->i_atime.tv_sec == v_atime 1481 && dchild->d_inode->i_atime.tv_sec == v_atime
1479 && dchild->d_inode->i_size == 0 ) 1482 && dchild->d_inode->i_size == 0 ) {
1483 if (created)
1484 *created = 1;
1480 goto set_attr; 1485 goto set_attr;
1486 }
1481 /* fallthru */ 1487 /* fallthru */
1482 case NFS3_CREATE_GUARDED: 1488 case NFS3_CREATE_GUARDED:
1483 err = nfserr_exist; 1489 err = nfserr_exist;