nfs: don't use nd->intent.open.flags
Instead check LOOKUP_EXCL in nd->flags, which is basically what the open intent flags were used for. Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> CC: Trond Myklebust <Trond.Myklebust@netapp.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
@@ -1538,7 +1538,7 @@ static int nfs4_lookup_revalidate(struct dentry *dentry, struct nameidata *nd)
|
|||||||
struct dentry *parent = NULL;
|
struct dentry *parent = NULL;
|
||||||
struct inode *inode;
|
struct inode *inode;
|
||||||
struct inode *dir;
|
struct inode *dir;
|
||||||
int openflags, ret = 0;
|
int ret = 0;
|
||||||
|
|
||||||
if (nd->flags & LOOKUP_RCU)
|
if (nd->flags & LOOKUP_RCU)
|
||||||
return -ECHILD;
|
return -ECHILD;
|
||||||
@@ -1562,9 +1562,8 @@ static int nfs4_lookup_revalidate(struct dentry *dentry, struct nameidata *nd)
|
|||||||
/* NFS only supports OPEN on regular files */
|
/* NFS only supports OPEN on regular files */
|
||||||
if (!S_ISREG(inode->i_mode))
|
if (!S_ISREG(inode->i_mode))
|
||||||
goto no_open_dput;
|
goto no_open_dput;
|
||||||
openflags = nd->intent.open.flags;
|
|
||||||
/* We cannot do exclusive creation on a positive dentry */
|
/* We cannot do exclusive creation on a positive dentry */
|
||||||
if ((openflags & (O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL))
|
if (nd && nd->flags & LOOKUP_EXCL)
|
||||||
goto no_open_dput;
|
goto no_open_dput;
|
||||||
|
|
||||||
/* Let f_op->open() actually open (and revalidate) the file */
|
/* Let f_op->open() actually open (and revalidate) the file */
|
||||||
@@ -1643,8 +1642,8 @@ static int nfs_create(struct inode *dir, struct dentry *dentry,
|
|||||||
attr.ia_mode = mode;
|
attr.ia_mode = mode;
|
||||||
attr.ia_valid = ATTR_MODE;
|
attr.ia_valid = ATTR_MODE;
|
||||||
|
|
||||||
if (nd)
|
if (nd && !(nd->flags & LOOKUP_EXCL))
|
||||||
open_flags = nd->intent.open.flags;
|
open_flags = O_CREAT;
|
||||||
|
|
||||||
error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags);
|
error = NFS_PROTO(dir)->create(dir, dentry, &attr, open_flags);
|
||||||
if (error != 0)
|
if (error != 0)
|
||||||
|
Reference in New Issue
Block a user