From: Trond Myklebust Date: Thu, 13 Jan 2011 19:15:50 +0000 (-0500) Subject: NFS: Fix NFSv3 exclusive open semantics X-Git-Tag: v3.0~2255 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8a0eebf66e3b1deae036553ba641a9c2bdbae678;p=platform%2Fkernel%2Flinux-amlogic.git NFS: Fix NFSv3 exclusive open semantics Commit c0204fd2b8fe047b18b67e07e1bf2a03691240cd (NFS: Clean up nfs4_proc_create()) broke NFSv3 exclusive open by removing the code that passes the O_EXCL flag down to nfs3_proc_create(). This patch reverts that offending hunk from the original commit. Reported-by: Nick Bowler Signed-off-by: Trond Myklebust Cc: stable@kernel.org [2.6.37] Tested-by: Nick Bowler Signed-off-by: Linus Torvalds --- diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 95b081b..64ee240 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -1579,6 +1579,7 @@ static int nfs_create(struct inode *dir, struct dentry *dentry, int mode, { struct iattr attr; int error; + int open_flags = 0; dfprintk(VFS, "NFS: create(%s/%ld), %s\n", dir->i_sb->s_id, dir->i_ino, dentry->d_name.name); @@ -1586,7 +1587,10 @@ static int nfs_create(struct inode *dir, struct dentry *dentry, int mode, attr.ia_mode = mode; attr.ia_valid = ATTR_MODE; - error = NFS_PROTO(dir)->create(dir, dentry, &attr, 0, NULL); + if ((nd->flags & LOOKUP_CREATE) != 0) + open_flags = nd->intent.open.flags; + + error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags, NULL); if (error != 0) goto out_err; return 0;