]> git.baikalelectronics.ru Git - kernel.git/commit
NFSv4.2: condition READDIR's mask for security label based on LSM state
authorOlga Kornievskaia <kolga@netapp.com>
Fri, 6 Nov 2020 21:03:38 +0000 (16:03 -0500)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Wed, 2 Dec 2020 19:05:51 +0000 (14:05 -0500)
commitad6a230c1dfa3d3c21c071b4769a382ef8f178ea
tree026d0b5e2c8303c958e3af4bce091aa4059bf6ef
parentd37adbb7da427a949844c49f00912743095086c4
NFSv4.2: condition READDIR's mask for security label based on LSM state

Currently, the client will always ask for security_labels if the server
returns that it supports that feature regardless of any LSM modules
(such as Selinux) enforcing security policy. This adds performance
penalty to the READDIR operation.

Client adjusts superblock's support of the security_label based on
the server's support but also current client's configuration of the
LSM modules. Thus, prior to using the default bitmask in READDIR,
this patch checks the server's capabilities and then instructs
READDIR to remove FATTR4_WORD2_SECURITY_LABEL from the bitmask.

v5: fixing silly mistakes of the rushed v4
v4: simplifying logic
v3: changing label's initialization per Ondrej's comment
v2: dropping selinux hook and using the sb cap.

Suggested-by: Ondrej Mosnacek <omosnace@redhat.com>
Suggested-by: Scott Mayhew <smayhew@redhat.com>
Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
Fixes: 064de62052d0 ("VFS: normal filesystems (and lustre): d_inode() annotations")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/nfs4proc.c