From 91b68bc4f4d8f25e88a252ca0918f0a422fec27b Mon Sep 17 00:00:00 2001 From: Bruno Faccini Date: Mon, 29 Sep 2014 19:53:23 +0200 Subject: [PATCH] LU-5573 obdclass: strengthen against concurrent server mounts This patch is an add-on to previous fix for LU-5299, against same issues/races scenarios during concurrent server devices mounts. Signed-off-by: Bruno Faccini Change-Id: Ib12332e9758f4a64fb8d7bdf60464100b4fd6c00 Reviewed-on: http://review.whamcloud.com/12114 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Bobi Jam Reviewed-by: Mike Pershin Reviewed-by: Oleg Drokin --- lustre/obdclass/obd_mount_server.c | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/lustre/obdclass/obd_mount_server.c b/lustre/obdclass/obd_mount_server.c index 2459473..6ca841f 100644 --- a/lustre/obdclass/obd_mount_server.c +++ b/lustre/obdclass/obd_mount_server.c @@ -1669,7 +1669,6 @@ static int osd_start(struct lustre_sb_info *lsi, unsigned long mflags) struct dt_device_param p; char flagstr[16]; int rc; - bool already_started = 0; ENTRY; CDEBUG(D_MOUNT, @@ -1694,11 +1693,13 @@ static int osd_start(struct lustre_sb_info *lsi, unsigned long mflags) LASSERT(obd); } else { CDEBUG(D_MOUNT, "%s already started\n", lsi->lsi_osd_obdname); - already_started = 1; /* but continue setup to allow special case of MDT and internal - * MGT being started separately, that will be identified in - * caller server_fill_super(). - */ + * MGT being started separately. */ + if (!((IS_MGS(lsi) && (lsi->lsi_lmd->lmd_flags & + LMD_FLG_NOMGS)) || + (IS_MDT(lsi) && (lsi->lsi_lmd->lmd_flags & + LMD_FLG_NOSVC)))) + RETURN(-EALREADY); } rc = obd_connect(NULL, &lsi->lsi_osd_exp, @@ -1707,12 +1708,10 @@ static int osd_start(struct lustre_sb_info *lsi, unsigned long mflags) OBD_FAIL_TIMEOUT(OBD_FAIL_TGT_DELAY_CONNECT, 10); if (rc) { - if (!already_started) { - obd->obd_force = 1; - class_manual_cleanup(obd); - lsi->lsi_dt_dev = NULL; - } - GOTO(out, rc); + obd->obd_force = 1; + class_manual_cleanup(obd); + lsi->lsi_dt_dev = NULL; + RETURN(rc); } LASSERT(obd->obd_lu_dev); @@ -1726,7 +1725,7 @@ static int osd_start(struct lustre_sb_info *lsi, unsigned long mflags) dt_conf_get(NULL, lsi->lsi_dt_dev, &p); out: - RETURN(already_started ? -EALREADY : rc); + RETURN(rc); } /** Fill in the superblock info for a Lustre server. @@ -1746,9 +1745,7 @@ int server_fill_super(struct super_block *sb) /* Start low level OSD */ rc = osd_start(lsi, sb->s_flags); - /* Handle separate nosvc and nomgs case */ - if (rc && ((rc != -EALREADY) || !(lsi->lsi_lmd->lmd_flags & - (LMD_FLG_NOSVC|LMD_FLG_NOMGS)))) { + if (rc) { CERROR("Unable to start osd on %s: %d\n", lsi->lsi_lmd->lmd_dev, rc); lustre_put_lsi(sb); -- 1.8.3.1