From 817184a9788ae399dcd5cf53ae7c9801e4778a43 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. Signed-off-by: Alex Zhuravlev Change-Id: Ib15f1ca56c47201bf6e29c12b3f81a11e55944ca Reviewed-on: https://review.whamcloud.com/c/fs/lustre-release/+/49378 Tested-by: jenkins Tested-by: Maloo Reviewed-by: Oleg Drokin Reviewed-by: Mikhail Pershin Reviewed-by: James Simmons --- lustre/include/lustre_disk.h | 1 + lustre/obdclass/obd_mount.c | 3 ++- lustre/target/tgt_mount.c | 5 +++-- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/lustre/include/lustre_disk.h b/lustre/include/lustre_disk.h index cad22a3..753a56f 100644 --- a/lustre/include/lustre_disk.h +++ b/lustre/include/lustre_disk.h @@ -373,6 +373,7 @@ int target_name2index(const char *svname, u32 *idx, const char **endptr); 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_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 cfa40d3..d2f4fe5 100644 --- a/lustre/obdclass/obd_mount.c +++ b/lustre/obdclass/obd_mount.c @@ -500,7 +500,7 @@ out_free: } EXPORT_SYMBOL(lustre_start_mgc); -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; @@ -568,6 +568,7 @@ out: mutex_unlock(&mgc_start_lock); RETURN(rc); } +EXPORT_SYMBOL(lustre_stop_mgc); /***************** lustre superblock **************/ diff --git a/lustre/target/tgt_mount.c b/lustre/target/tgt_mount.c index 7e86174..442e289 100644 --- a/lustre/target/tgt_mount.c +++ b/lustre/target/tgt_mount.c @@ -1674,6 +1674,7 @@ 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. */ + 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)) @@ -1685,8 +1686,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