aboutsummaryrefslogtreecommitdiff
path: root/fs/nfs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/dir.c9
-rw-r--r--fs/nfs/getroot.c14
-rw-r--r--fs/nfs/inode.c13
-rw-r--r--fs/nfs/super.c2
4 files changed, 16 insertions, 22 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index efdba2e802d..3e64b98f3a9 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -707,9 +707,7 @@ static int nfs_is_exclusive_create(struct inode *dir, struct nameidata *nd)
{
if (NFS_PROTO(dir)->version == 2)
return 0;
- if (nd == NULL || nfs_lookup_check_intent(nd, LOOKUP_CREATE) == 0)
- return 0;
- return (nd->intent.open.flags & O_EXCL) != 0;
+ return nd && nfs_lookup_check_intent(nd, LOOKUP_EXCL);
}
/*
@@ -1009,7 +1007,7 @@ static struct dentry *nfs_atomic_lookup(struct inode *dir, struct dentry *dentry
/* Let vfs_create() deal with O_EXCL. Instantiate, but don't hash
* the dentry. */
- if (nd->intent.open.flags & O_EXCL) {
+ if (nd->flags & LOOKUP_EXCL) {
d_instantiate(dentry, NULL);
goto out;
}
@@ -1959,6 +1957,9 @@ force_lookup:
} else
res = PTR_ERR(cred);
out:
+ if (!res && (mask & MAY_EXEC) && !execute_ok(inode))
+ res = -EACCES;
+
dfprintk(VFS, "NFS: permission(%s/%ld), mask=0x%x, res=%d\n",
inode->i_sb->s_id, inode->i_ino, mask, res);
return res;
diff --git a/fs/nfs/getroot.c b/fs/nfs/getroot.c
index fae97196daa..b7c9b2df1f2 100644
--- a/fs/nfs/getroot.c
+++ b/fs/nfs/getroot.c
@@ -107,11 +107,10 @@ struct dentry *nfs_get_root(struct super_block *sb, struct nfs_fh *mntfh)
* if the dentry tree reaches them; however if the dentry already
* exists, we'll pick it up at this point and use it as the root
*/
- mntroot = d_alloc_anon(inode);
- if (!mntroot) {
- iput(inode);
+ mntroot = d_obtain_alias(inode);
+ if (IS_ERR(mntroot)) {
dprintk("nfs_get_root: get root dentry failed\n");
- return ERR_PTR(-ENOMEM);
+ return mntroot;
}
security_d_instantiate(mntroot, inode);
@@ -277,11 +276,10 @@ struct dentry *nfs4_get_root(struct super_block *sb, struct nfs_fh *mntfh)
* if the dentry tree reaches them; however if the dentry already
* exists, we'll pick it up at this point and use it as the root
*/
- mntroot = d_alloc_anon(inode);
- if (!mntroot) {
- iput(inode);
+ mntroot = d_obtain_alias(inode);
+ if (IS_ERR(mntroot)) {
dprintk("nfs_get_root: get root dentry failed\n");
- return ERR_PTR(-ENOMEM);
+ return mntroot;
}
security_d_instantiate(mntroot, inode);
diff --git a/fs/nfs/inode.c b/fs/nfs/inode.c
index b9195c02a86..d22eb383e1c 100644
--- a/fs/nfs/inode.c
+++ b/fs/nfs/inode.c
@@ -5,7 +5,7 @@
*
* nfs inode and superblock handling functions
*
- * Modularised by Alan Cox <Alan.Cox@linux.org>, while hacking some
+ * Modularised by Alan Cox <alan@lxorguk.ukuu.org.uk>, while hacking some
* experimental NFS changes. Modularisation taken straight from SYS5 fs.
*
* Change to nfs_read_super() to permit NFS mounts to multi-homed hosts.
@@ -908,21 +908,16 @@ static int nfs_size_need_update(const struct inode *inode, const struct nfs_fatt
return nfs_size_to_loff_t(fattr->size) > i_size_read(inode);
}
-static unsigned long nfs_attr_generation_counter;
+static atomic_long_t nfs_attr_generation_counter;
static unsigned long nfs_read_attr_generation_counter(void)
{
- smp_rmb();
- return nfs_attr_generation_counter;
+ return atomic_long_read(&nfs_attr_generation_counter);
}
unsigned long nfs_inc_attr_generation_counter(void)
{
- unsigned long ret;
- smp_rmb();
- ret = ++nfs_attr_generation_counter;
- smp_wmb();
- return ret;
+ return atomic_long_inc_return(&nfs_attr_generation_counter);
}
void nfs_fattr_init(struct nfs_fattr *fattr)
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index a3b0061dfd4..f48db679a1c 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -5,7 +5,7 @@
*
* nfs superblock handling functions
*
- * Modularised by Alan Cox <Alan.Cox@linux.org>, while hacking some
+ * Modularised by Alan Cox <alan@lxorguk.ukuu.org.uk>, while hacking some
* experimental NFS changes. Modularisation taken straight from SYS5 fs.
*
* Change to nfs_read_super() to permit NFS mounts to multi-homed hosts.