Whamcloud - gitweb
LU-17996 mgs: add ability to clear exports 96/55596/2
authorSebastien Buisson <sbuisson@ddn.com>
Tue, 2 Jul 2024 08:04:56 +0000 (10:04 +0200)
committerOleg Drokin <green@whamcloud.com>
Sat, 13 Jul 2024 20:57:12 +0000 (20:57 +0000)
Just like with other targets (MDT, OST), give the ability to clear
dead exports from the exports list 'mgs.MGS.exports'.
Improve sanity-sec test_31 to benefit from this new ability.

Test-Parameters: trivial
Test-Parameters: testgroup=review-dne-part-2
Signed-off-by: Sebastien Buisson <sbuisson@ddn.com>
Change-Id: I4e99de31834753d223fd3cfe226f6f0343f2586b
Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/55596
Tested-by: jenkins <devops@whamcloud.com>
Tested-by: Maloo <maloo@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Reviewed-by: James Simmons <jsimmons@infradead.org>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
lustre/mgs/lproc_mgs.c
lustre/tests/sanity-sec.sh

index 606ff1e..86bc4c4 100644 (file)
@@ -187,6 +187,7 @@ int lproc_mgs_del_live(struct mgs_device *mgs, struct fs_db *fsdb)
 LPROC_SEQ_FOPS_RO_TYPE(mgs, hash);
 LPROC_SEQ_FOPS_WR_ONLY(mgs, evict_client);
 LPROC_SEQ_FOPS_RW_TYPE(mgs, ir_timeout);
+LPROC_SEQ_FOPS_RW_TYPE(mgs, nid_stats_clear);
 
 static struct lprocfs_vars lprocfs_mgs_obd_vars[] = {
        { .name =       "hash_stats",
@@ -301,6 +302,9 @@ int lproc_mgs_setup(struct mgs_device *mgs, const char *osd_name)
                 obd->obd_proc_exports_entry = NULL;
                GOTO(out, rc);
         }
+       if (obd->obd_proc_exports_entry)
+               lprocfs_add_simple(obd->obd_proc_exports_entry, "clear",
+                                  obd, &mgs_nid_stats_clear_fops);
 
        rc = sysfs_create_link(&obd->obd_kset.kobj, &mgs->mgs_bottom->dd_kobj,
                               "osd");
index a4e18b1..3e2bb9b 100755 (executable)
@@ -2523,6 +2523,7 @@ test_31() {
        local net2=${NETTYPE}999
        local mdsnid=$(do_facet mds1 $LCTL list_nids | head -1)
        local addr1=${mdsnid%@*}
+       local nid2=${addr}@$net2
        local addr2 failover_mds1
 
        export LNETCTL=$(which lnetctl 2> /dev/null)
@@ -2576,7 +2577,19 @@ test_31() {
                umount_client $MOUNT || error "umount $MOUNT failed"
        fi
 
+       do_facet mgs "$LCTL set_param mgs.MGS.exports.clear=clear"
+       do_nodes $(comma_list $(mdts_nodes) $(osts_nodes)) \
+               "$LCTL set_param *.${FSNAME}*.exports.clear=clear"
+
        # check exports on servers are empty for client
+       wait_update_facet_cond mgs \
+               "$LCTL get_param -N mgs.MGS.exports.* | grep $nid |
+               cut -d'.' -f4-" '!=' $nid
+       for node in $(mdts_nodes) $(osts_nodes); do
+               wait_update_cond $node \
+                       "$LCTL get_param -N *.${FSNAME}*.exports | grep $nid |
+                       cut -d'.' -f4-" '!=' $nid
+       done
        do_facet mgs "lctl get_param *.MGS*.exports.*.export"
        do_facet mgs "lctl get_param -n *.MGS*.exports.'$nid'.uuid 2>/dev/null |
                      grep -q -" && error "export on MGS should be empty"
@@ -2641,10 +2654,10 @@ test_31() {
        [ $? -ne 0 ] || error "export for $nid on MGS should not exist"
 
        do_facet mgs \
-               "lctl get_param -n *.MGS*.exports.'${addr}@$net2'.uuid \
+               "lctl get_param -n *.MGS*.exports.'$nid2'.uuid \
                 2>/dev/null | grep -"
        [ $? -eq 0 ] ||
-               error "export for ${addr}@$net2 on MGS should exist"
+               error "export for $nid2 on MGS should exist"
 
        # check {mdc,osc} imports
        lctl get_param mdc.${FSNAME}-*.import | grep current_connection |
@@ -2669,6 +2682,20 @@ test_31() {
        # unmount client
        zconf_umount $HOSTNAME $MOUNT || error "unable to umount client"
 
+       do_facet mgs "$LCTL set_param mgs.MGS.exports.clear=clear"
+       do_nodes $(comma_list $(mdts_nodes) $(osts_nodes)) \
+               "$LCTL set_param *.${FSNAME}*.exports.clear=clear"
+
+       wait_update_facet_cond mgs \
+               "$LCTL get_param -N mgs.MGS.exports.* | grep $nid2 |
+               cut -d'.' -f4-" '!=' $nid2
+       for node in $(mdts_nodes) $(osts_nodes); do
+               wait_update_cond $node \
+                       "$LCTL get_param -N *.${FSNAME}*.exports | grep $nid2 |
+                       cut -d'.' -f4-" '!=' $nid2
+       done
+       do_facet mgs "lctl get_param *.MGS*.exports.*.export"
+
        # on client, configure LNet and turn LNet Dynamic Discovery on (default)
        $LUSTRE_RMMOD || error "$LUSTRE_RMMOD failed (2)"
        load_modules || error "Failed to load modules"