From d4927da410525db5f0524d618da47a17fe9c7835 Mon Sep 17 00:00:00 2001 From: Sebastien Buisson Date: Tue, 23 Jan 2024 10:07:25 +0100 Subject: [PATCH] LU-17465 nodemap: change squash default value to 65534 Initially, default values for nodemap.squash_uid/gid/projid were set to 99, to match user 'nobody'. But on newer systems, nobody has changed to 65534 and 99 no longer exists. It is safe to use 65534 in all cases, as even on older systems it exists and corresponds to 'nfsnobody'. Test-Parameters: testlist=sanity env=ONLY=432 serverversion=2.15 Test-Parameters: testlist=sanity env=ONLY=432 clientversion=2.15 Test-Parameters: testlist=sanity-quota env=ONLY=75 serverversion=2.15 Test-Parameters: testlist=sanity-quota env=ONLY=75 clientversion=2.15 Test-Parameters: testlist=sanity-selinux env=ONLY=21 serverversion=2.15 Test-Parameters: testlist=sanity-selinux env=ONLY=21 clientversion=2.15 Test-Parameters: testlist=sanity-sec env=ONLY="7 8 9 10 11 12 13 14 15 16 18 19 20 21 22 23 24 25 26 27 32 33 34 35 36 55 61 64" serverversion=2.15 Test-Parameters: testlist=sanity-sec env=ONLY="7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 32 33 34 35 36 55 61 64" clientversion=2.15 Signed-off-by: Sebastien Buisson Change-Id: I2e20fda0fdc0d5bfdf964a890bfbd0b54b943cf4 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/53802 Reviewed-by: James Simmons Reviewed-by: Oleg Drokin Reviewed-by: Andreas Dilger Tested-by: Maloo Tested-by: jenkins --- lustre/ptlrpc/nodemap_internal.h | 6 +++--- lustre/tests/cfg/local.sh | 1 + lustre/tests/sanity-sec.sh | 16 ++++++++-------- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/lustre/ptlrpc/nodemap_internal.h b/lustre/ptlrpc/nodemap_internal.h index 009f72e..b3765e4 100644 --- a/lustre/ptlrpc/nodemap_internal.h +++ b/lustre/ptlrpc/nodemap_internal.h @@ -37,9 +37,9 @@ #define DEFAULT_NODEMAP "default" /* Default nobody uid, gid and projid values */ -#define NODEMAP_NOBODY_UID 99 -#define NODEMAP_NOBODY_GID 99 -#define NODEMAP_NOBODY_PROJID 99 +#define NODEMAP_NOBODY_UID 65534 +#define NODEMAP_NOBODY_GID 65534 +#define NODEMAP_NOBODY_PROJID 65534 struct lprocfs_static_vars; diff --git a/lustre/tests/cfg/local.sh b/lustre/tests/cfg/local.sh index 1de9611..07cf928 100644 --- a/lustre/tests/cfg/local.sh +++ b/lustre/tests/cfg/local.sh @@ -114,6 +114,7 @@ TSTUSR=${TSTUSR:-"quota_usr"} TSTUSR2=${TSTUSR2:-"quota_2usr"} USER0=${USER0:-"sanityusr"} USER1=${USER1:-"sanityusr1"} +NOBODY_UID=${NOBODY_UID:-65534} ENABLE_QUOTA=${ENABLE_QUOTA:-""} QUOTA_TYPE=${QUOTA_TYPE:-"ug3"} diff --git a/lustre/tests/sanity-sec.sh b/lustre/tests/sanity-sec.sh index b654679..f8d1a1f 100755 --- a/lustre/tests/sanity-sec.sh +++ b/lustre/tests/sanity-sec.sh @@ -254,9 +254,9 @@ create_nodemaps() { local i local rc - squash_id default 99 0 + squash_id default ${NOBODY_UID:-65534} 0 wait_nm_sync default squash_uid '' inactive - squash_id default 99 1 + squash_id default ${NOBODY_UID:-65534} 1 wait_nm_sync default squash_gid '' inactive for (( i = 0; i < NODEMAP_COUNT; i++ )); do local csum=${HOSTNAME_CHECKSUM}_${i} @@ -521,12 +521,12 @@ squash_id() { } # ensure that the squash defaults are the expected defaults -squash_id default 99 0 +squash_id default ${NOBODY_UID:-65534} 0 wait_nm_sync default squash_uid '' inactive -squash_id default 99 1 +squash_id default ${NOBODY_UID:-65534} 1 wait_nm_sync default squash_gid '' inactive if [ "$MDS1_VERSION" -ge $(version_code 2.14.50) ]; then - squash_id default 99 2 + squash_id default ${NOBODY_UID:-65534} 2 wait_nm_sync default squash_projid '' inactive fi @@ -648,12 +648,12 @@ test_idmap() { fi done - ## check that root is mapped to 99 + ## check that root is mapped to NOBODY_UID for ((j = 0; j < NODEMAP_RANGE_COUNT; j++)); do nid="$SUBNET_CHECKSUM.0.${j}.100@tcp" fs_id=$(do_facet mgs $cmd --nid $nid --idtype uid --id 0) - if [ $fs_id != 99 ]; then - error "root squash expected 99, got $fs_id" + if [ $fs_id != $NOBODY_UID ]; then + error "root squash expected $NOBODY_UID, got $fs_id" rc=$((rc + 1)) fi done -- 1.8.3.1