Whamcloud - gitweb
b=11778
authornathan <nathan>
Tue, 24 Jul 2007 20:02:18 +0000 (20:02 +0000)
committernathan <nathan>
Tue, 24 Jul 2007 20:02:18 +0000 (20:02 +0000)
i=adilger
i=green
block client->MDT connection until first MDT->OST connection

lustre/ChangeLog
lustre/include/obd.h
lustre/mds/mds_lov.c
lustre/obdclass/obd_mount.c
lustre/tests/conf-sanity.sh
lustre/tests/sanity.sh

index 07b7ca9..fa18321 100644 (file)
@@ -17,6 +17,15 @@ tbd         Cluster File Systems, Inc. <info@clusterfs.com>
         should be installed.  It is versioned separately from Lustre and
         may be released separately in future.
 
+Severity   : minor
+Frequency  : only at startup
+Bugzilla   : 11778
+Description: Delay client connections to MDT until fist MDT->OST connect
+Details    : If a client tried to create a new file before the MDT had
+            connected to any OSTs, the create would return EIO.  Now
+            the client will simply block until the MDT connects to the 
+            first OST and the create can succeed.
+       
 Severity   : normal
 Frequency  : only for SLES9
 Bugzilla   : 12543
index b388317..7484762 100644 (file)
@@ -447,7 +447,6 @@ struct mds_obd {
         obd_id                          *mds_lov_objids;
         int                              mds_lov_objids_size;
         __u32                            mds_lov_objids_in_file;
-        unsigned int                     mds_lov_objids_dirty:1;
         int                              mds_lov_nextid_set;
         struct file                     *mds_lov_objid_filp;
         struct file                     *mds_health_check_filp;
@@ -458,8 +457,11 @@ struct mds_obd {
         struct semaphore                 mds_qonoff_sem;
         struct semaphore                 mds_health_sem;
         unsigned long                    mds_lov_objids_valid:1,
+                                         mds_lov_objids_dirty:1,
                                          mds_fl_user_xattr:1,
-                                         mds_fl_acl:1;
+                                         mds_fl_acl:1,
+                                         mds_fl_cfglog:1,
+                                         mds_fl_synced:1;
 };
 
 struct echo_obd {
@@ -680,6 +682,9 @@ enum obd_notify_event {
         OBD_NOTIFY_CONFIG
 };
 
+#define CONFIG_LOG  0x1  /* finished processing config log */
+#define CONFIG_SYNC 0x2  /* mdt synced 1 ost */
+
 /*
  * Data structure used to pass obd_notify()-event to non-obd listeners (llite
  * and liblustre being main examples).
index 36e1617..4df5c5b 100644 (file)
@@ -632,6 +632,18 @@ int mds_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 
 }
 
+/* Collect the preconditions we need to allow client connects */
+static void mds_allow_cli(struct obd_device *obd, unsigned int flag)
+{
+        if (flag & CONFIG_LOG)
+                obd->u.mds.mds_fl_cfglog = 1;
+        if (flag & CONFIG_SYNC)
+                obd->u.mds.mds_fl_synced = 1;
+        if (obd->u.mds.mds_fl_cfglog && obd->u.mds.mds_fl_synced)
+                /* Open for clients */
+                obd->obd_no_conn = 0;
+}
+
 struct mds_lov_sync_info {
         struct obd_device *mlsi_obd;     /* the lov device to sync */
         struct obd_device *mlsi_watched; /* target osc */
@@ -705,7 +717,12 @@ out:
                        rc);
                 obd_notify(mds->mds_osc_obd, watched, OBD_NOTIFY_INACTIVE,
                            NULL);
+        } else {
+                /* We've successfully synced at least 1 OST and are ready
+                   to handle client requests */
+                mds_allow_cli(obd, CONFIG_SYNC);
         }
+
         class_decref(obd);
         return rc;
 }
@@ -792,8 +809,7 @@ int mds_notify(struct obd_device *obd, struct obd_device *watched,
         case OBD_NOTIFY_SYNC_NONBLOCK:
                 break;
         case OBD_NOTIFY_CONFIG:
-                /* Open for clients */
-                obd->obd_no_conn = 0;
+                mds_allow_cli(obd, (unsigned int)data);
         default:
                 RETURN(0);
         }
@@ -816,6 +832,7 @@ int mds_notify(struct obd_device *obd, struct obd_device *watched,
                 mutex_down(&obd->obd_dev_sem);
                 rc = mds_lov_update_desc(obd, obd->u.mds.mds_osc_exp);
                 mutex_up(&obd->obd_dev_sem);
+                mds_allow_cli(obd, CONFIG_SYNC);
                 RETURN(rc);
         }
 
index e5ce038..79e0aa7 100644 (file)
@@ -726,8 +726,8 @@ static int lustre_stop_mgc(struct super_block *sb)
 {
         struct lustre_sb_info *lsi = s2lsi(sb);
         struct obd_device *obd;
-        char *niduuid, *ptr = 0;
-        int i, rc = 0, len;
+        char *niduuid = 0, *ptr = 0;
+        int i, rc = 0, len = 0;
         ENTRY;
 
         if (!lsi)
@@ -1099,7 +1099,7 @@ out_mgc:
                 }
 
                 /* log has been fully processed */
-                obd_notify(obd, NULL, OBD_NOTIFY_CONFIG, 0);
+                obd_notify(obd, NULL, OBD_NOTIFY_CONFIG, (void *)CONFIG_LOG);
         }
 
         RETURN(rc);
index 9a71dd0..cc0ed11 100644 (file)
@@ -294,8 +294,6 @@ run_test 5d "mount with ost down"
 test_5e() {
        start_ost
        start_mds
-        # give MDS a chance to connect to OSTs (bz 10476)
-       sleep 5 
 
 #define OBD_FAIL_PTLRPC_DELAY_SEND       0x506
        do_facet client "sysctl -w lustre.fail_loc=0x80000506"
@@ -768,26 +766,21 @@ test_22() {
         #reformat to remove all logs
         reformat
        start_mds
-       echo Client mount before any osts are in the logs
+
+       echo Client mount with a running ost
+       start_ost
        mount_client $MOUNT
-       check_mount && return 41
+       check_mount || return 41
+       umount_client $MOUNT
        pass
 
        echo Client mount with ost in logs, but none running
-       start_ost
        stop_ost
        mount_client $MOUNT
        # check_mount will block trying to contact ost
        umount_client $MOUNT
        pass
 
-       echo Client mount with a running ost
-       start_ost
-       mount_client $MOUNT
-       sleep 5 #bz10476
-       check_mount || return 41
-       pass
-
        cleanup
 }
 run_test 22 "start a client before osts (should return errs)"
@@ -1081,15 +1074,6 @@ test_32a() {
        $LCTL conf_param lustre-MDT0000.failover.node=$NID || return 10
        echo "ok."
 
-       # With a new good MDT failover nid, we should be able to mount a client
-       # (but it cant talk to OST)
-        local OLDMOUNTOPT=$MOUNTOPT
-        MOUNTOPT="exclude=lustre-OST0000"
-       mount_client $MOUNT
-        MOUNTOPT=$OLDMOUNTOPT
-       set_and_check "cat $LPROC/mdc/*/max_rpcs_in_flight" "lustre-MDT0000.mdc.max_rpcs_in_flight" || return 11
-
-       zconf_umount `hostname` $MOUNT -f
        cleanup_nocli
 
         # mount a second time to make sure we didnt leave upgrade flag on
index f688bea..a55f51b 100644 (file)
@@ -2095,6 +2095,7 @@ test_51() {
                FNUM=$(($FNUM + 1))
                echo -n "+"
        done
+       echo
        ls -l $DIR/d51 > /dev/null || error
 }
 run_test 51 "special situations: split htree with empty entry =="