NFS: Ensure the NFS_CAP_SECURITY_LABEL capability is set when appropriate
authorScott Mayhew <smayhew@redhat.com>
Wed, 2 Jun 2021 17:13:11 +0000 (13:13 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 3 Jun 2021 14:14:42 +0000 (10:14 -0400)
commit0b4f132b15f988831dfca8f96af272e437eacf05
tree32d4c0026d6822b908dd201f20a38b280261b1ff
parentf8849e206ef52b584cd9227255f4724f0cc900bb
NFS: Ensure the NFS_CAP_SECURITY_LABEL capability is set when appropriate

Commit ce62b114bbad ("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: ce62b114bbad ("NFS: Split attribute support out from the server capabilities")
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/nfs4proc.c