Commit 84631f84 authored by Trond Myklebust's avatar Trond Myklebust

NFS: Clean up NFSv4.2 xattrs

Add a helper for the xattr mask so that we can get rid of the inlined
ifdefs.
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent f1ec501d
...@@ -2995,11 +2995,8 @@ static int nfs_do_access(struct inode *inode, const struct cred *cred, int mask) ...@@ -2995,11 +2995,8 @@ static int nfs_do_access(struct inode *inode, const struct cred *cred, int mask)
/* /*
* Determine which access bits we want to ask for... * Determine which access bits we want to ask for...
*/ */
cache.mask = NFS_ACCESS_READ | NFS_ACCESS_MODIFY | NFS_ACCESS_EXTEND; cache.mask = NFS_ACCESS_READ | NFS_ACCESS_MODIFY | NFS_ACCESS_EXTEND |
if (nfs_server_capable(inode, NFS_CAP_XATTR)) { nfs_access_xattr_mask(NFS_SERVER(inode));
cache.mask |= NFS_ACCESS_XAREAD | NFS_ACCESS_XAWRITE |
NFS_ACCESS_XALIST;
}
if (S_ISDIR(inode->i_mode)) if (S_ISDIR(inode->i_mode))
cache.mask |= NFS_ACCESS_DELETE | NFS_ACCESS_LOOKUP; cache.mask |= NFS_ACCESS_DELETE | NFS_ACCESS_LOOKUP;
else else
......
...@@ -388,6 +388,20 @@ int nfs_mknod(struct user_namespace *, struct inode *, struct dentry *, umode_t, ...@@ -388,6 +388,20 @@ int nfs_mknod(struct user_namespace *, struct inode *, struct dentry *, umode_t,
int nfs_rename(struct user_namespace *, struct inode *, struct dentry *, int nfs_rename(struct user_namespace *, struct inode *, struct dentry *,
struct inode *, struct dentry *, unsigned int); struct inode *, struct dentry *, unsigned int);
#ifdef CONFIG_NFS_V4_2
static inline __u32 nfs_access_xattr_mask(const struct nfs_server *server)
{
if (!(server->caps & NFS_CAP_XATTR))
return 0;
return NFS4_ACCESS_XAREAD | NFS4_ACCESS_XAWRITE | NFS4_ACCESS_XALIST;
}
#else
static inline __u32 nfs_access_xattr_mask(const struct nfs_server *server)
{
return 0;
}
#endif
/* file.c */ /* file.c */
int nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync); int nfs_file_fsync(struct file *file, loff_t start, loff_t end, int datasync);
loff_t nfs_file_llseek(struct file *, loff_t, int); loff_t nfs_file_llseek(struct file *, loff_t, int);
......
...@@ -1392,13 +1392,8 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry, ...@@ -1392,13 +1392,8 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry,
case NFS4_OPEN_CLAIM_FH: case NFS4_OPEN_CLAIM_FH:
p->o_arg.access = NFS4_ACCESS_READ | NFS4_ACCESS_MODIFY | p->o_arg.access = NFS4_ACCESS_READ | NFS4_ACCESS_MODIFY |
NFS4_ACCESS_EXTEND | NFS4_ACCESS_DELETE | NFS4_ACCESS_EXTEND | NFS4_ACCESS_DELETE |
NFS4_ACCESS_EXECUTE; NFS4_ACCESS_EXECUTE |
#ifdef CONFIG_NFS_V4_2 nfs_access_xattr_mask(server);
if (!(server->caps & NFS_CAP_XATTR))
break;
p->o_arg.access |= NFS4_ACCESS_XAREAD | NFS4_ACCESS_XAWRITE |
NFS4_ACCESS_XALIST;
#endif
} }
p->o_arg.clientid = server->nfs_client->cl_clientid; p->o_arg.clientid = server->nfs_client->cl_clientid;
p->o_arg.id.create_time = ktime_to_ns(sp->so_seqid.create_time); p->o_arg.id.create_time = ktime_to_ns(sp->so_seqid.create_time);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment