diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2011-01-13 14:15:50 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-02-17 15:14:13 -0800 |
commit | f5cc08212d21eb9e855ea6d4ad2b5a68afcf06a9 (patch) | |
tree | bde13aa2665440bec6b47bda52cca79c363b0559 /fs | |
parent | 55ea499d60aefa3d03a77fc8590c26b5881faa92 (diff) |
NFS: Fix NFSv3 exclusive open semantics
commit 8a0eebf66e3b1deae036553ba641a9c2bdbae678 upstream.
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 <nbowler@elliptictech.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Tested-by: Nick Bowler <nbowler@elliptictech.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/dir.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c index 0108cf4f3403..bd80b38a1384 100644 --- a/fs/nfs/dir.c +++ b/fs/nfs/dir.c @@ -1577,6 +1577,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); @@ -1584,7 +1585,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; |