From ae475331db533826fe444a71bf61ad08d42c0a21 Mon Sep 17 00:00:00 2001 From: Andreas Dilger Date: Tue, 30 Jul 2024 14:54:14 -0600 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. Test-Parameters: trivial Test-Parameters: testlist=conf-sanity env=ONLY=98 clientdistro=ubuntu2404 Signed-off-by: Andreas Dilger Change-Id: I34de0fdbd4ca36228d313b53251b5dbcfc502b07 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55891 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Frederick Dilger Reviewed-by: Jian Yu Reviewed-by: James Simmons 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 4b78b56..030dbe7 100755 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -8220,11 +8220,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 78dd13c..787d40a 100644 --- a/lustre/utils/mount_lustre.c +++ b/lustre/utils/mount_lustre.c @@ -242,7 +242,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; } @@ -819,7 +823,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); @@ -833,7 +837,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); @@ -844,7 +849,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