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

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
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -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...
	 */
	cache.mask = NFS_ACCESS_READ | NFS_ACCESS_MODIFY | NFS_ACCESS_EXTEND;
	if (nfs_server_capable(inode, NFS_CAP_XATTR)) {
		cache.mask |= NFS_ACCESS_XAREAD | NFS_ACCESS_XAWRITE |
		    NFS_ACCESS_XALIST;
	}
	cache.mask = NFS_ACCESS_READ | NFS_ACCESS_MODIFY | NFS_ACCESS_EXTEND |
		     nfs_access_xattr_mask(NFS_SERVER(inode));
	if (S_ISDIR(inode->i_mode))
		cache.mask |= NFS_ACCESS_DELETE | NFS_ACCESS_LOOKUP;
	else
+14 −0
Original line number Diff line number Diff line
@@ -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 *,
	       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 */
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);
+2 −7
Original line number Diff line number Diff line
@@ -1392,13 +1392,8 @@ static struct nfs4_opendata *nfs4_opendata_alloc(struct dentry *dentry,
	case NFS4_OPEN_CLAIM_FH:
		p->o_arg.access = NFS4_ACCESS_READ | NFS4_ACCESS_MODIFY |
				  NFS4_ACCESS_EXTEND | NFS4_ACCESS_DELETE |
				  NFS4_ACCESS_EXECUTE;
#ifdef CONFIG_NFS_V4_2
		if (!(server->caps & NFS_CAP_XATTR))
			break;
		p->o_arg.access |= NFS4_ACCESS_XAREAD | NFS4_ACCESS_XAWRITE |
				   NFS4_ACCESS_XALIST;
#endif
				  NFS4_ACCESS_EXECUTE |
				  nfs_access_xattr_mask(server);
	}
	p->o_arg.clientid = server->nfs_client->cl_clientid;
	p->o_arg.id.create_time = ktime_to_ns(sp->so_seqid.create_time);