Whamcloud - gitweb
LU-18756 sec: add resource id check to oss and mds 08/59208/6
authorMarc Vef <mvef@whamcloud.com>
Tue, 13 May 2025 11:27:31 +0000 (13:27 +0200)
committerOleg Drokin <green@whamcloud.com>
Thu, 12 Jun 2025 06:32:50 +0000 (06:32 +0000)
commit719f6763fe19d208833040a36d47ad360da465f2
treed3590b0dfcfd3b37974b33f869e7c919b1b10dff
parent36431c49484bf9e0a237f015f606c9c10ead47cc
LU-18756 sec: add resource id check to oss and mds

This patch includes the resource id check into the relevant code paths
on the oss and mds side. It is therefore included for the following
operations.

On the MDT-side:
- open
- create (file and directory)
- unlink (file and directory)
- setattr
- setxattr
- getxattr
- rename
- link

On the OST-side and on the MDT-side for Data on MDT (DoM) files:
- write
- read
- truncate
- fallocate

Some caveats:
The resource id check is not included for MDS_GETATTR RPCs due to
functional and usability concerns. Specifically for the latter, the
"struct stat" would no longer be filled resulting in "?" when running
"ls -l", which can be misunderstood.

Also, if the check is only enabled on the OST-side, writes are only
denied for "sync"/"fsync"-type operations on a file as the check is at
the server-side. If the check is enabled on the MDT-side, write-access
is denied before the OST_WRITE RPC is sent, i.e., immediately
returning the access denied error code. If a file is still in the page
cache before the check is enabled, a client can still read the local
copy of the file, which is expected.

Sanity-sec test 75a was added to exercise the ID check for the above
cases in several disciplines further testing that access to
neighboring nodemap offset ranges work as expected.

Test-Parameters: trivial testlist=sanity-sec
Signed-off-by: Marc Vef <mvef@whamcloud.com>
Change-Id: I040ddb1b934707baa84b492337139f45b856692e
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/59208
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
lustre/mdt/mdt_io.c
lustre/mdt/mdt_open.c
lustre/mdt/mdt_reint.c
lustre/mdt/mdt_xattr.c
lustre/ofd/ofd_io.c
lustre/ofd/ofd_objects.c
lustre/tests/sanity-sec.sh