From f7688f0b2314937914a10d66a9288c5fd1b0b308 Mon Sep 17 00:00:00 2001 From: Alex Zhuravlev Date: Mon, 12 Dec 2022 16:35:41 +0300 Subject: [PATCH] LU-16385 obdlcass: stop MGC before MGS drops a reference to MGC when MGS is being umounted so that MGC doesn't try to disconnected from a missing MGS which can take long and hurt HA. Lustre-change: https://review.whamcloud.com/49378 Lustre-commit: 817184a9788ae399dcd5cf53ae7c9801e4778a43 Signed-off-by: Alex Zhuravlev Change-Id: Ib15f1ca56c47201bf6e29c12b3f81a11e55944ca Reviewed-by: Mikhail Pershin Reviewed-by: James Simmons Reviewed-on: https://review.whamcloud.com/c/ex/lustre-release/+/49641 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/include/lustre_disk.h | 1 + lustre/obdclass/obd_mount.c | 3 ++- lustre/obdclass/obd_mount_server.c | 8 +++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index 5fcd6d1..7000e7e 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -352,6 +352,7 @@ int lustre_put_lsi(struct super_block *sb); int lustre_start_simple(char *obdname, char *type, char *uuid, char *s1, char *s2, char *s3, char *s4); int lustre_start_mgc(struct super_block *sb); +int lustre_stop_mgc(struct super_block *sb); #endif /* HAVE_SERVER_SUPPORT */ int server_name2fsname(const char *svname, char *fsname, const char **endptr); void obdname2fsname(const char *tgt, char *fsname, size_t fslen); diff --git a/lustre/obdclass/obd_mount.c b/lustre/obdclass/obd_mount.c index dab0b17..e9d4507 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -502,7 +502,7 @@ out_free: RETURN(rc); } -static int lustre_stop_mgc(struct super_block *sb) +int lustre_stop_mgc(struct super_block *sb) { struct lustre_sb_info *lsi = s2lsi(sb); struct obd_device *obd; @@ -581,6 +581,7 @@ out: mutex_unlock(&mgc_start_lock); RETURN(rc); } +EXPORT_SYMBOL(lustre_stop_mgc); /***************** lustre superblock **************/ diff --git a/lustre/obdclass/obd_mount_server.c b/lustre/obdclass/obd_mount_server.c index ef877b9..e095491 100644 --- a/lustre/obdclass/obd_mount_server.c +++ b/lustre/obdclass/obd_mount_server.c @@ -1644,7 +1644,9 @@ static void server_put_super(struct super_block *sb) } /* If they wanted the mgs to stop separately from the mdt, they - should have put it on a different device. */ + * should have put it on a different device. + */ + lustre_stop_mgc(sb); if (IS_MGS(lsi)) { /* if MDS start with --nomgs, don't stop MGS then */ if (!(lsi->lsi_lmd->lmd_flags & LMD_FLG_NOMGS)) @@ -1656,8 +1658,8 @@ static void server_put_super(struct super_block *sb) CERROR("%s: failed to stop lwp!\n", tmpname); } - /* Clean the mgc and sb */ - lustre_common_put_super(sb); + /* Drop a ref to the mounted disk */ + lustre_put_lsi(sb); /* wait till all in-progress cleanups are done * specifically we're interested in ofd cleanup -- 1.8.3.1