From d1f49b124592132242096c907bfba23362fdda88 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Fri, 12 Aug 2022 09:59:02 +0200 Subject: [PATCH] LU-16085 llite: fix stat attributes_mask Fix stat attributes_mask to return STATX_ATTR_ENCRYPTED whenever it is possible. Also fix sanityn test_106c to expect at least the 0x30 flag for attributes_mask. Lustre-change: https://review.whamcloud.com/48208 Lustre-commit: 0e48653c27eacad29dbff1589da771ad4f5d1014 Signed-off-by: Sebastien Buisson LU-16085 tests: fix sanityn test_106c Fix sanityn test_106c after modification introduced when fixing stat attributes_mask. Lustre-change: https://review.whamcloud.com/48435 Lustre-commit: TBD (12ab7defee65a82b495dab9ba2da03dcc7d55799) Test-Parameters: trivial testlist=sanityn env=ONLY=106c Fixes: 0e48653c27 ("LU-16085 llite: fix stat attributes_mask") Signed-off-by: Sebastien Buisson Change-Id: Icd16beff058c42d77e9b04ad1a287ec2ac04dfed Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Reviewed-on: https://review.whamcloud.com/48404 Reviewed-by: Alex Zhuravlev Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin --- lustre/llite/file.c | 3 +++ lustre/tests/sanityn.sh | 4 ++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lustre/llite/file.c b/lustre/llite/file.c index 2c05c9e..1fd08f4 100644 --- a/lustre/llite/file.c +++ b/lustre/llite/file.c @@ -5340,6 +5340,9 @@ fill_attr: } stat->attributes_mask = STATX_ATTR_IMMUTABLE | STATX_ATTR_APPEND; +#ifdef HAVE_LUSTRE_CRYPTO + stat->attributes_mask |= STATX_ATTR_ENCRYPTED; +#endif stat->attributes |= ll_inode_to_ext_flags(inode->i_flags); stat->result_mask &= request_mask; #endif diff --git a/lustre/tests/sanityn.sh b/lustre/tests/sanityn.sh index 0972705..b70d809 100755 --- a/lustre/tests/sanityn.sh +++ b/lustre/tests/sanityn.sh @@ -5567,8 +5567,8 @@ test_106c() { # Mask supported in stx_attributes by Lustre is # STATX_ATTR_IMMUTABLE(0x10) | STATX_ATTR_APPEND(0x20) : (0x30). mask=$($STATX -c %p $DIR/$tfile) - [[ $mask == "30" ]] || - error "supported stx_attributes: got '$mask', expected '30'" + (( (0x$mask & 0x30) == 0x30 )) || + error "supported stx_attributes: got '0x$mask', expected '0x30' at least" chattr +i $DIR/$tfile || error "chattr +i $DIR/$tfile failed" mask=$($STATX -c %r $DIR/$tfile) [[ $mask == "10" ]] || -- 1.8.3.1