NFSv4: Add 'server capability' flags for NFSv4 recommended attributes
If the NFSv4 server doesn't support a POSIX attribute, the generic NFS code needs to know that, so that it don't keep trying to poll for it. However, by the same count, if the NFSv4 server does support that attribute, then we should ensure that the inode metadata is appropriately labelled as being untrusted. For instance, if we don't know the correct value of the file's uid, we should certainly not be caching ACLs or ACCESS results. Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
@@ -2003,12 +2003,34 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f
|
||||
status = nfs4_call_sync(server, &msg, &args, &res, 0);
|
||||
if (status == 0) {
|
||||
memcpy(server->attr_bitmask, res.attr_bitmask, sizeof(server->attr_bitmask));
|
||||
server->caps &= ~(NFS_CAP_ACLS|NFS_CAP_HARDLINKS|
|
||||
NFS_CAP_SYMLINKS|NFS_CAP_FILEID|
|
||||
NFS_CAP_MODE|NFS_CAP_NLINK|NFS_CAP_OWNER|
|
||||
NFS_CAP_OWNER_GROUP|NFS_CAP_ATIME|
|
||||
NFS_CAP_CTIME|NFS_CAP_MTIME);
|
||||
if (res.attr_bitmask[0] & FATTR4_WORD0_ACL)
|
||||
server->caps |= NFS_CAP_ACLS;
|
||||
if (res.has_links != 0)
|
||||
server->caps |= NFS_CAP_HARDLINKS;
|
||||
if (res.has_symlinks != 0)
|
||||
server->caps |= NFS_CAP_SYMLINKS;
|
||||
if (res.attr_bitmask[0] & FATTR4_WORD0_FILEID)
|
||||
server->caps |= NFS_CAP_FILEID;
|
||||
if (res.attr_bitmask[1] & FATTR4_WORD1_MODE)
|
||||
server->caps |= NFS_CAP_MODE;
|
||||
if (res.attr_bitmask[1] & FATTR4_WORD1_NUMLINKS)
|
||||
server->caps |= NFS_CAP_NLINK;
|
||||
if (res.attr_bitmask[1] & FATTR4_WORD1_OWNER)
|
||||
server->caps |= NFS_CAP_OWNER;
|
||||
if (res.attr_bitmask[1] & FATTR4_WORD1_OWNER_GROUP)
|
||||
server->caps |= NFS_CAP_OWNER_GROUP;
|
||||
if (res.attr_bitmask[1] & FATTR4_WORD1_TIME_ACCESS)
|
||||
server->caps |= NFS_CAP_ATIME;
|
||||
if (res.attr_bitmask[1] & FATTR4_WORD1_TIME_METADATA)
|
||||
server->caps |= NFS_CAP_CTIME;
|
||||
if (res.attr_bitmask[1] & FATTR4_WORD1_TIME_MODIFY)
|
||||
server->caps |= NFS_CAP_MTIME;
|
||||
|
||||
memcpy(server->cache_consistency_bitmask, res.attr_bitmask, sizeof(server->cache_consistency_bitmask));
|
||||
server->cache_consistency_bitmask[0] &= FATTR4_WORD0_CHANGE|FATTR4_WORD0_SIZE;
|
||||
server->cache_consistency_bitmask[1] &= FATTR4_WORD1_TIME_METADATA|FATTR4_WORD1_TIME_MODIFY;
|
||||
|
Reference in New Issue
Block a user