Whamcloud - gitweb
Branch b1_5
authornathan <nathan>
Wed, 10 May 2006 18:00:05 +0000 (18:00 +0000)
committernathan <nathan>
Wed, 10 May 2006 18:00:05 +0000 (18:00 +0000)
b=10516
Rather than cleanup and re-setup llogs for each OST addition, instead just call
setup only.  This makes sure that there is no window between the two where
someone calling llog_get_ctxt will fail.  Change llog_setup to a NOP if it's
already set up.

lustre/include/obd.h
lustre/lov/lov_log.c
lustre/mds/handler.c
lustre/mds/mds_lov.c
lustre/obdclass/llog_obd.c

index 16ea176..cc5b5bd 100644 (file)
@@ -433,7 +433,6 @@ struct mds_obd {
         struct file                     *mds_lov_objid_filp;
         struct file                     *mds_health_check_filp;
         unsigned long                   *mds_client_bitmap;
-        struct semaphore                 mds_orphan_recovery_sem;
         struct upcall_cache             *mds_group_hash;
 
         struct lustre_quota_info         mds_quota_info;
index 34fd545..0b23662 100644 (file)
@@ -193,7 +193,7 @@ int lov_llog_init(struct obd_device *obd, struct obd_device *tgt,
                 RETURN(rc);
 
         CDEBUG(D_CONFIG, "llog init with %d targets\n", count);
-        LASSERT(lov->desc.ld_tgt_count == count);
+        /* count may not match ld_tgt_count during dynamic ost add */
         for (i = 0, ctgt = lov->tgts; i < lov->desc.ld_tgt_count; i++, ctgt++) {
                 struct obd_device *child;
                 if (!ctgt->ltd_active)
index 252c1fc..5f2e87d 100644 (file)
@@ -1876,7 +1876,6 @@ static int mds_setup(struct obd_device *obd, obd_count len, void *buf)
 
         LASSERT(!lvfs_check_rdonly(lvfs_sbdev(mnt->mnt_sb)));
 
-        sema_init(&mds->mds_orphan_recovery_sem, 1);
         sema_init(&mds->mds_epoch_sem, 1);
         spin_lock_init(&mds->mds_transno_lock);
         mds->mds_max_mdsize = sizeof(struct lov_mds_md);
index 0f95347..d02e9a9 100644 (file)
@@ -295,11 +295,9 @@ static int mds_lov_update_mds(struct obd_device *obd,
         /* Only do this at first add (idx), or the first time after recovery */
         if (idx != MDSLOV_NO_INDEX || 1/*FIXME*/) {
                 CDEBUG(D_CONFIG, "reset llogs idx=%d\n", idx);
-                /* These two must be atomic */
-                down(&mds->mds_orphan_recovery_sem);
-                obd_llog_finish(obd, old_count);
+                /* Note that this will cause multiple mds/lov/osc_llog_init's
+                   with no llog_cleanup's, so fns should deal with that. */
                 llog_cat_initialize(obd, mds->mds_lov_desc.ld_tgt_count);
-                up(&mds->mds_orphan_recovery_sem);
         }
 
         RETURN(rc);
index 5f6e680..ee88e3a 100644 (file)
@@ -72,16 +72,17 @@ int llog_setup(struct obd_device *obd, int index, struct obd_device *disk_obd,
                 RETURN(-EFAULT);
 
         if (obd->obd_llog_ctxt[index]) {
-        /* During an mds_lov_add_ost, we try to tear down and resetup llogs.
-           But the mdt teardown does not flow down to the lov/osc's as the 
-           setup does, because the lov/osc must clean up only when they are
-           done, not when the mdt is done. So instead, we just assume that
-           if the lov llogs are already set up then we must cleanup first. */
+                /* mds_lov_update_mds might call here multiple times. So if the
+                   llog is already set up then don't to do it again. */
                 CDEBUG(D_CONFIG, "obd %s ctxt %d already set up\n", 
                        obd->obd_name, index);
-                llog_cleanup(obd->obd_llog_ctxt[index]);
+                ctxt = obd->obd_llog_ctxt[index];
+                LASSERT(ctxt->loc_obd == obd);
+                LASSERT(ctxt->loc_exp == disk_obd->obd_self_export);
+                LASSERT(ctxt->loc_logops == op);
+                RETURN(0);
         }
-
+        
         OBD_ALLOC(ctxt, sizeof(*ctxt));
         if (!ctxt)
                 RETURN(-ENOMEM);