Whamcloud - gitweb
LU-5573 obdclass: strengthen against concurrent server mounts 53/12353/4
authorBruno Faccini <bruno.faccini@intel.com>
Tue, 21 Oct 2014 01:33:50 +0000 (18:33 -0700)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 1 Dec 2014 04:21:57 +0000 (04:21 +0000)
This patch is an add-on to previous fix for LU-5299, against same
issues/races scenarios during concurrent server devices mounts.

This patch is back-ported from the following one:
Lustre-commit: 91b68bc4f4d8f25e88a252ca0918f0a422fec27b
Lustre-change: http://review.whamcloud.com/12114

Test-Parameters: alwaysuploadlogs \
envdefinitions=SLOW=yes,ENABLE_QUOTA=yes,CONF_SANITY_EXCEPT=45 \
mdtfilesystemtype=zfs mdsfilesystemtype=zfs ostfilesystemtype=zfs \
ostcount=2 ostsizegb=8 testlist=conf-sanity,conf-sanity,conf-sanity

Signed-off-by: Bruno Faccini <bruno.faccini@intel.com>
Change-Id: I121ee3f14d4bee7973cd968d561e8fc03acb6386
Reviewed-on: http://review.whamcloud.com/12353
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Bobi Jam <bobijam@gmail.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/obdclass/obd_mount_server.c

index b0ba7e3..e10dc96 100644 (file)
@@ -1620,7 +1620,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,
@@ -1645,11 +1644,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,
@@ -1658,12 +1659,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);
@@ -1677,7 +1676,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.
@@ -1697,9 +1696,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);