From c7e307d943be5fd8a60d680d428ae198844be93e Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Mon, 26 May 2025 01:44:19 -0700 Subject: [PATCH] LU-18081 tests: improve conf-sanity/98 testing conf-sanity test_98 is failing for newer distros like Ubuntu 24.04 and SLES15sp6, which have newer userspace tools. Print better error messages about what options are being processed to help debug this issue. It appears mount is now deduplicating options passed on the command-line, which invalidates the test case. Change test_98 to call mount.lustre directly to verify this handling. Lustre-change: https://review.whamcloud.com/55891 Lustre-commit: ae475331db533826fe444a71bf61ad08d42c0a21 Test-Parameters: trivial Test-Parameters: testlist=conf-sanity env=ONLY=98 clientdistro=sles15sp6 Signed-off-by: Andreas Dilger Change-Id: I34de0fdbd4ca36228d313b53251b5dbcfc502b07 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/59433 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Frederick Dilger Reviewed-by: Oleg Drokin --- lustre/tests/conf-sanity.sh | 7 +++++-- lustre/utils/mount_lustre.c | 17 +++++++++++++---- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index 228e220..2c36fe2 100755 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -7784,11 +7784,14 @@ test_98() setup check_mount || error "mount failed" mountopt="user_xattr" - for ((x = 1; x <= PAGE_SIZE/11; x++)); do + for ((x = 1; x <= PAGE_SIZE/10; x++)); do mountopt="$mountopt,user_xattr" done - mount_client $MOUNT remount,$mountopt 2>&1 | grep "too long" || + mount.lustre -o remount,$mountopt -v $MGSNID:/$FSNAME $MOUNT 2>&1 | + tee $TMP/$tfile.out + grep "too long" $TMP/$tfile.out || error "Buffer overflow check failed" + cleanup || error "cleanup failed" } run_test 98 "Buffer-overflow check while parsing mount_opts" diff --git a/lustre/utils/mount_lustre.c b/lustre/utils/mount_lustre.c index 3ce3ed0..2e58c2f 100644 --- a/lustre/utils/mount_lustre.c +++ b/lustre/utils/mount_lustre.c @@ -280,7 +280,11 @@ static int append_option(char *options, size_t options_len, } return 0; out_err: - fprintf(stderr, "error: mount options %s%s too long\n", param, value); + /* this 'too long' message is checked in conf-sanity test_98 */ + fprintf(stderr, + "error: add mount options %s%s too long, %zu over limit %zu\n", + param, value, strlen(options) + strlen(param) + strlen(value), + options_len); return E2BIG; } @@ -857,7 +861,7 @@ int main(int argc, char *const argv[]) g_pagesize = sysconf(_SC_PAGESIZE); if (g_pagesize == -1) { rc = errno; - printf("error: %d failed to get page size.\n", rc); + printf("error: failed to get page size: %s\n", strerror(rc)); return rc; } maxopt_len = MIN(g_pagesize, 64 * 1024); @@ -871,7 +875,8 @@ int main(int argc, char *const argv[]) printf("arg[%d] = %s\n", i, argv[i]); printf("source = %s (%s), target = %s\n", mop.mo_usource, mop.mo_source, mop.mo_target); - printf("options = %s\n", mop.mo_orig_options); + printf("options(%zu/%zu) = %s\n", strlen(mop.mo_orig_options), + maxopt_len, mop.mo_orig_options); } options = malloc(maxopt_len); @@ -882,7 +887,11 @@ int main(int argc, char *const argv[]) } if (strlen(mop.mo_orig_options) >= maxopt_len) { - fprintf(stderr, "error: mount options too long\n"); + /* this 'too long' message is checked in conf-sanity test_98 */ + + fprintf(stderr, + "error: mount options too long, %zu over limit %zu\n", + strlen(mop.mo_orig_options), maxopt_len); rc = E2BIG; goto out_options; } -- 1.8.3.1