Skip to content

Commit 0b4f132

Browse files
scottmayhewTrond Myklebust
authored andcommitted
NFS: Ensure the NFS_CAP_SECURITY_LABEL capability is set when appropriate
Commit ce62b11 ("NFS: Split attribute support out from the server capabilities") removed the logic from _nfs4_server_capabilities() that sets the NFS_CAP_SECURITY_LABEL capability based on the presence of FATTR4_WORD2_SECURITY_LABEL in the attr_bitmask of the server's response. Now NFS_CAP_SECURITY_LABEL is never set, which breaks labelled NFS. This was replaced with logic that clears the NFS_ATTR_FATTR_V4_SECURITY_LABEL bit in the newly added fattr_valid field based on the absence of FATTR4_WORD2_SECURITY_LABEL in the attr_bitmask of the server's response. This essentially has no effect since there's nothing looks for that bit in fattr_supported. So revert that part of the commit, but adding the logic that sets NFS_CAP_SECURITY_LABEL near where the other capabilities are set in _nfs4_server_capabilities(). Fixes: ce62b11 ("NFS: Split attribute support out from the server capabilities") Signed-off-by: Scott Mayhew <[email protected]> Signed-off-by: Trond Myklebust <[email protected]>
1 parent f8849e2 commit 0b4f132

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/nfs/nfs4proc.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3878,6 +3878,10 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f
38783878
server->caps |= NFS_CAP_HARDLINKS;
38793879
if (res.has_symlinks != 0)
38803880
server->caps |= NFS_CAP_SYMLINKS;
3881+
#ifdef CONFIG_NFS_V4_SECURITY_LABEL
3882+
if (res.attr_bitmask[2] & FATTR4_WORD2_SECURITY_LABEL)
3883+
server->caps |= NFS_CAP_SECURITY_LABEL;
3884+
#endif
38813885
if (!(res.attr_bitmask[0] & FATTR4_WORD0_FILEID))
38823886
server->fattr_valid &= ~NFS_ATTR_FATTR_FILEID;
38833887
if (!(res.attr_bitmask[1] & FATTR4_WORD1_MODE))
@@ -3898,10 +3902,6 @@ static int _nfs4_server_capabilities(struct nfs_server *server, struct nfs_fh *f
38983902
server->fattr_valid &= ~NFS_ATTR_FATTR_CTIME;
38993903
if (!(res.attr_bitmask[1] & FATTR4_WORD1_TIME_MODIFY))
39003904
server->fattr_valid &= ~NFS_ATTR_FATTR_MTIME;
3901-
#ifdef CONFIG_NFS_V4_SECURITY_LABEL
3902-
if (!(res.attr_bitmask[2] & FATTR4_WORD2_SECURITY_LABEL))
3903-
server->fattr_valid &= ~NFS_ATTR_FATTR_V4_SECURITY_LABEL;
3904-
#endif
39053905
memcpy(server->attr_bitmask_nl, res.attr_bitmask,
39063906
sizeof(server->attr_bitmask));
39073907
server->attr_bitmask_nl[2] &= ~FATTR4_WORD2_SECURITY_LABEL;

0 commit comments

Comments
 (0)