Whamcloud - gitweb
- MDS doesn't fail if llog isn't supported
authoralex <alex>
Tue, 9 Jun 2009 08:48:33 +0000 (08:48 +0000)
committeralex <alex>
Tue, 9 Jun 2009 08:48:33 +0000 (08:48 +0000)
lustre/mds/handler.c
lustre/mds/mds_lov.c
lustre/mdt/mdt_handler.c
lustre/obdclass/llog_obd.c

index 2601d64..228af5d 100644 (file)
@@ -356,12 +356,15 @@ static int mds_cmd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
         lmi = server_get_mount_2(dev);
         LASSERT(lmi != NULL);
 
+        init_rwsem(&mds->mds_notify_lock);
+
         lsi = s2lsi(lmi->lmi_sb);
         lmi->lmi_dt->dd_ops->dt_conf_get(NULL, lmi->lmi_dt, &dt_param);
         mnt = dt_param.ddp_mnt;
-        LASSERT(mnt);
-
-        init_rwsem(&mds->mds_notify_lock);
+        if (mnt == NULL) {
+                CERROR("non-ldiskfs underlying filesystem\n");
+                goto new_diskfs;
+        }
 
         obd->obd_fsops = fsfilt_get_ops(MT_STR(lsi->lsi_ldd));
         mds_init_ctxt(obd, mnt);
@@ -389,6 +392,8 @@ static int mds_cmd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                 CERROR("__iopen__ directory has no inode? rc = %d\n", rc);
                 GOTO(err_fid, rc);
         }
+
+new_diskfs:
         rc = mds_lov_init_objids(obd);
         if (rc != 0) {
                CERROR("cannot init lov objid rc = %d\n", rc);
@@ -411,7 +416,8 @@ static int mds_cmd_setup(struct obd_device *obd, struct lustre_cfg *lcfg)
                 GOTO(err_objects, rc);
 
 err_pop:
-        pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+        if (mnt)
+                pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
         RETURN(rc);
 err_fid:
         dput(mds->mds_fid_de);
@@ -438,21 +444,24 @@ static int mds_cmd_cleanup(struct obd_device *obd)
         if (strncmp(obd->obd_name, MDD_OBD_NAME, strlen(MDD_OBD_NAME)))
                 RETURN(0);
 
-        push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
-
         mds_lov_destroy_objids(obd);
 
-        if (mds->mds_objects_dir != NULL) {
-                l_dput(mds->mds_objects_dir);
-                mds->mds_objects_dir = NULL;
-        }
+        if (obd->obd_fsops) {
+                /* only if underlying fs supports fsfilt */
+                push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
 
-        shrink_dcache_parent(mds->mds_fid_de);
-        dput(mds->mds_fid_de);
-        LL_DQUOT_OFF(obd->u.obt.obt_sb);
-        fsfilt_put_ops(obd->obd_fsops);
+                if (mds->mds_objects_dir != NULL) {
+                        l_dput(mds->mds_objects_dir);
+                        mds->mds_objects_dir = NULL;
+                }
+
+                shrink_dcache_parent(mds->mds_fid_de);
+                dput(mds->mds_fid_de);
+                LL_DQUOT_OFF(obd->u.obt.obt_sb);
+                fsfilt_put_ops(obd->obd_fsops);
 
-        pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+                pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+        }
         server_put_mount_2(obd->obd_name);
         RETURN(rc);
 }
index afb7564..aae60e7 100644 (file)
@@ -407,10 +407,14 @@ int mds_lov_write_objids(struct obd_device *obd)
                         size = (mds->mds_lov_objid_lastidx+1) * sizeof(obd_id);
 
                 CDEBUG(D_INFO, "write %lld - %u\n", off, size);
-                rc = fsfilt_write_record(obd, mds->mds_lov_objid_filp, data,
+                if (obd->obd_fsops) {
+                        rc = fsfilt_write_record(obd, mds->mds_lov_objid_filp, data,
                                          size, &off, 0);
-                if (rc < 0)
-                        break;
+                        if (rc < 0)
+                                break;
+                } else {
+                        CERROR("not implemented yet\n");
+                }
                 cfs_bitmap_clear(mds->mds_lov_page_dirty, i);
         }
         if (rc >= 0)
@@ -757,7 +761,7 @@ static int __mds_lov_synchronize(void *data)
         __u32  idx = mlsi->mlsi_index;
         struct mds_group_info mgi;
         struct llog_ctxt *ctxt;
-        int rc = 0;
+        int rc = 0, rc2;
         ENTRY;
 
         OBD_FREE_PTR(mlsi);
@@ -790,17 +794,17 @@ static int __mds_lov_synchronize(void *data)
                 GOTO(out, rc);
 
         ctxt = llog_get_context(obd, LLOG_MDS_OST_ORIG_CTXT);
-        if (!ctxt)
-                GOTO(out, rc = -ENODEV);
-
-        OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT, 60);
-        rc = llog_connect(ctxt, NULL, NULL, uuid);
-        llog_ctxt_put(ctxt);
-        if (rc != 0) {
-                CERROR("%s failed at llog_origin_connect: %d\n",
-                       obd_uuid2str(uuid), rc);
-                GOTO(out, rc);
-        }
+        if (ctxt) {
+                OBD_FAIL_TIMEOUT(OBD_FAIL_MDS_LLOG_SYNC_TIMEOUT, 60);
+                rc = llog_connect(ctxt, NULL, NULL, uuid);
+                llog_ctxt_put(ctxt);
+                if (rc != 0) {
+                        CERROR("%s failed at llog_origin_connect: %d\n",
+                                        obd_uuid2str(uuid), rc);
+                        GOTO(out, rc);
+                }
+        } else
+                CERROR("can't get llog context\n");
 
         LCONSOLE_INFO("MDS %s: %s now active, resetting orphans\n",
               obd->obd_name, obd_uuid2str(uuid));
@@ -826,6 +830,7 @@ static int __mds_lov_synchronize(void *data)
 out:
         up_read(&mds->mds_notify_lock);
         if (rc) {
+#if 0
                 /* Deactivate it for safety */
                 CERROR("%s sync failed %d, deactivating\n", obd_uuid2str(uuid),
                        rc);
@@ -833,6 +838,7 @@ out:
                     !mds->mds_osc_obd->obd_stopping && !watched->obd_stopping)
                         obd_notify(mds->mds_osc_obd, watched,
                                    OBD_NOTIFY_INACTIVE, NULL);
+#endif
         }
 
         class_decref(obd, "mds_lov_synchronize", obd);
index 7608740..275c816 100644 (file)
@@ -1856,7 +1856,7 @@ static int mdt_llog_ctxt_clone(const struct lu_env *env, struct mdt_device *mdt,
         rc = next->md_ops->mdo_llog_ctxt_get(env, next, idx, (void **)&ctxt);
         if (rc || ctxt == NULL) {
                 CERROR("Can't get mdd ctxt %d\n", rc);
-                return rc;
+                return 0;
         }
 
         rc = llog_group_set_ctxt(&mdt2obd_dev(mdt)->obd_olg, ctxt, idx);
@@ -4235,6 +4235,9 @@ static int mdt_stack_init(struct lu_env *env,
         rc = child_lu_dev->ld_ops->ldo_prepare(env,
                                                &m->mdt_md_dev.md_lu_dev,
                                                child_lu_dev);
+
+        /* XXX: to simplify debugging */
+        LASSERT(rc == 0);
 out:
         /* fini from last known good lu_device */
         if (rc)
@@ -4258,6 +4261,10 @@ static int mdt_obd_llog_setup(struct obd_device *obd,
         LASSERT(obd->obd_fsops == NULL);
         lmi->lmi_dt->dd_ops->dt_conf_get(NULL, lmi->lmi_dt, &dt_param);
         mnt = dt_param.ddp_mnt;
+        if (mnt == NULL) {
+                CERROR("no llog support on this device\n");
+                return 0;
+        }
         LASSERT(mnt);
 
         obd->obd_fsops = fsfilt_get_ops(MT_STR(lsi->lsi_ldd));
index 41fb346..8a6b4da 100644 (file)
@@ -450,6 +450,11 @@ int llog_cat_initialize(struct obd_device *obd, struct obd_llog_group *olg,
         int rc;
         ENTRY;
 
+        if (obd->obd_lvfs_ctxt.magic != OBD_RUN_CTXT_MAGIC) {
+                CERROR("llog isn't initialized\n");
+                RETURN(0);
+        }
+
         mutex_down(&olg->olg_cat_processing);
         rc = llog_get_cat_list(obd, obd, name, idx, 1, &idarray);
         if (rc) {