From 10b256a65b8fd746ca7952b40d9026a957b171bc Mon Sep 17 00:00:00 2001 From: Hongchao Zhang Date: Sun, 28 Apr 2013 18:12:58 +0800 Subject: [PATCH] LU-3101 mgs: deregister the mount for failed case in server_start_mgs, the mount of MGS should be put if MGS failed to start up. Change-Id: I03c7c3c8e0c578391b637fe0bcdf48da5e318db8 Signed-off-by: Hongchao Zhang Reviewed-on: http://review.whamcloud.com/6035 Tested-by: Hudson Reviewed-by: Fan Yong Tested-by: Maloo Reviewed-by: Andreas Dilger --- lustre/mgs/mgs_handler.c | 5 ++++- lustre/obdclass/obd_mount_server.c | 11 ++++++++--- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lustre/mgs/mgs_handler.c b/lustre/mgs/mgs_handler.c index cc600b4..ae7b941 100644 --- a/lustre/mgs/mgs_handler.c +++ b/lustre/mgs/mgs_handler.c @@ -1078,7 +1078,7 @@ static int mgs_init0(const struct lu_env *env, struct mgs_device *mgs, rc = mgs_connect_to_osd(mgs, lustre_cfg_string(lcfg, 3)); if (rc) - RETURN(rc); + GOTO(err_lmi, rc); obd = class_name2obd(lustre_cfg_string(lcfg, 0)); LASSERT(obd); @@ -1195,6 +1195,9 @@ err_ops: lu_cdebug_printer); } obd_disconnect(mgs->mgs_bottom_exp); +err_lmi: + if (lmi) + server_put_mount(obd->obd_name, lmi->lmi_mnt); RETURN(rc); } diff --git a/lustre/obdclass/obd_mount_server.c b/lustre/obdclass/obd_mount_server.c index f3c5368..f2d7785 100644 --- a/lustre/obdclass/obd_mount_server.c +++ b/lustre/obdclass/obd_mount_server.c @@ -257,9 +257,14 @@ static int server_start_mgs(struct super_block *sb) rc = lustre_start_simple(LUSTRE_MGS_OBDNAME, LUSTRE_MGS_NAME, LUSTRE_MGS_OBDNAME, 0, 0, lsi->lsi_osd_obdname, 0); - /* Do NOT call server_deregister_mount() here. This leads to - * inability cleanup cleanly and free lsi and other stuff when - * mgs calls server_put_mount() in error handling case. -umka */ + /* server_deregister_mount() is not called previously, for lsi + * and other stuff can't be freed cleanly when mgs calls + * server_put_mount() in error handling case (see b=17758), + * this problem is caused by a bug in mgs_init0, which forgot + * calling server_put_mount in error case. */ + + if (rc) + server_deregister_mount(LUSTRE_MGS_OBDNAME); } if (rc) -- 1.8.3.1