Whamcloud - gitweb
LU-3101 mgs: deregister the mount for failed case 35/6035/5
authorHongchao Zhang <hongchao.zhang@intel.com>
Sun, 28 Apr 2013 10:12:58 +0000 (18:12 +0800)
committerOleg Drokin <oleg.drokin@intel.com>
Wed, 10 Jul 2013 02:30:42 +0000 (02:30 +0000)
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 <hongchao.zhang@intel.com>
Reviewed-on: http://review.whamcloud.com/6035
Tested-by: Hudson
Reviewed-by: Fan Yong <fan.yong@intel.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
lustre/mgs/mgs_handler.c
lustre/obdclass/obd_mount_server.c

index cc600b4..ae7b941 100644 (file)
@@ -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)
 
        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);
 
        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);
                                lu_cdebug_printer);
        }
        obd_disconnect(mgs->mgs_bottom_exp);
+err_lmi:
+       if (lmi)
+               server_put_mount(obd->obd_name, lmi->lmi_mnt);
        RETURN(rc);
 }
 
        RETURN(rc);
 }
 
index f3c5368..f2d7785 100644 (file)
@@ -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);
                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)
        }
 
        if (rc)