From 20ce9d366f5d424e15dd684ff1ec50a26662da1f Mon Sep 17 00:00:00 2001 From: Mikhail Pershin Date: Wed, 5 Mar 2025 14:26:08 +0300 Subject: [PATCH] LU-18799 utils: mount with maximum NIDs Patch allows mount with maxumum NIDs in parameters. - reserve space for mandatory mount options: 'device', etc. - remove duplicate mgsnode list as parameter in mount options - update 73b test to check mount is working too Fixes: f9d346f0c1 ("LU-18587 utils: allow large NID lists in mount tools") Signed-off-by: Mikhail Pershin Change-Id: I46c296694a053c710310bced94ec95afae76b800 Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/58375 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger Reviewed-by: Sebastien Buisson Reviewed-by: Oleg Drokin --- lustre/tests/conf-sanity.sh | 36 ++++++++++++++++++++++++------------ lustre/utils/mount_lustre.c | 6 ++++++ lustre/utils/mount_utils.c | 2 +- 3 files changed, 31 insertions(+), 13 deletions(-) diff --git a/lustre/tests/conf-sanity.sh b/lustre/tests/conf-sanity.sh index eaa5837..2dfa2a5 100755 --- a/lustre/tests/conf-sanity.sh +++ b/lustre/tests/conf-sanity.sh @@ -6755,28 +6755,40 @@ test_73b() { local ostdev=$(ostdevname 1) local nids="111.222.173._@$NETTYPE,111.222.142._@$NETTYPE" - local min=160 - local iter=$((min * 14 / 20)) + local iter=60 + local cmd do_facet ost1 "$TUNEFS --comment='just a comment for tail' $ostdev" || error "1st tunefs failed" - # 4K can fit ~180 IPv4 NIDs, try more for checking failure case too - # add in pairs just to reduce test time + # 4K can fit ~200 IPv4 NIDs, try more for checking failure case too + # add in pairs in both mgsnode and failnode to reduce test time for ((i = 1; i <= $iter; i++)); do - do_facet ost1 "$TUNEFS --failnode=${nids//_/$i} $ostdev" >/dev/null || + local cmd="--failnode=${nids//_/$i} --mgsnode=${nids//_/$i}" + do_facet ost1 "$TUNEFS $cmd $ostdev" >/dev/null || break done - echo "added $i/$iter NID failover pairs" + + start_mgsmds || error "Fail to start mds" + start_ost || error "Fail to mount ost" + + local zkeeper=${KEEP_ZPOOL} + stack_trap "KEEP_ZPOOL=$zkeeper" EXIT + KEEP_ZPOOL="true" + stop_ost + stop_mds + # count the actual number of failover NIDs configured in failover.node # there may be some previously configured, so they should also count - local count=$(do_facet ost1 $TUNEFS --dryrun $ostdev | grep "^Param" | - sed -e "s/.*failover.node=//" -e "s/[:,]/\n/g" | - grep -c $NETTYPE) - do_facet ost1 "$TUNEFS --erase-param failover.node $ostdev" + local count=$(do_facet ost1 "$TUNEFS --erase-params $ostdev" | + grep "^Param" | grep -Fo '@' | wc -l) + echo "Found total $count NIDs in parameters" + + KEEP_ZPOOL="${zkeeper}" + reformat - # expect to fit more that 160 NIDs at least - ((count >= min)) || error "Only $count NIDs configured, need >= $min" + # expect to fit more that 32 mgsnode and 4*32 failover NIDs at least + ((count >= 160)) || error "Only $count NIDs found, need >= (128+32)" } run_test 73b "Large failnode NID list in mountdata" diff --git a/lustre/utils/mount_lustre.c b/lustre/utils/mount_lustre.c index d440644..a6cbb56 100644 --- a/lustre/utils/mount_lustre.c +++ b/lustre/utils/mount_lustre.c @@ -500,6 +500,7 @@ static int parse_ldd(char *source, struct mount_opts *mop, struct lustre_disk_data *ldd = &mop->mo_ldd; char *cur, *start; char *temp_options; + bool skip_mgsnode_param = false; int rc = 0; rc = osd_is_lustre(source, &ldd->ldd_mount_type); @@ -584,6 +585,7 @@ static int parse_ldd(char *source, struct mount_opts *mop, if (add_mgsnids(mop, options, ldd->ldd_params, options_len)) return E2BIG; + skip_mgsnode_param = true; } } /* Better have an mgsnid by now */ @@ -635,6 +637,10 @@ static int parse_ldd(char *source, struct mount_opts *mop, *start = '\0'; start++; } + + if (skip_mgsnode_param && !strncmp(cur, "mgsnode", 7)) + continue; + rc = append_option(options, options_len, "param=", cur); if (rc != 0) return rc; diff --git a/lustre/utils/mount_utils.c b/lustre/utils/mount_utils.c index 8d59e29..3239d1d 100644 --- a/lustre/utils/mount_utils.c +++ b/lustre/utils/mount_utils.c @@ -120,7 +120,7 @@ int run_command(char *cmd, int cmdsz) return rc; } -#define MAXNIDSTR LDD_PARAM_LEN +#define MAXNIDSTR (LDD_PARAM_LEN - 256) #ifdef HAVE_SERVER_SUPPORT int add_param(char *buf, char *key, char *val) -- 1.8.3.1