Whamcloud - gitweb
Branch b1_4_mountconf
authornathan <nathan>
Fri, 30 Dec 2005 00:23:41 +0000 (00:23 +0000)
committernathan <nathan>
Fri, 30 Dec 2005 00:23:41 +0000 (00:23 +0000)
b=9851
start of trying to allow ost addition after mds is setup

lustre/lov/lov_obd.c
lustre/mds/handler.c
lustre/mds/mds_lov.c
lustre/mgc/mgc_request.c
lustre/obdclass/genops.c
lustre/obdclass/obd_config.c
lustre/obdclass/obd_mount.c
lustre/utils/module_setup.sh

index 687e597..ee437a0 100644 (file)
@@ -520,7 +520,8 @@ lov_add_obd(struct obd_device *obd, struct obd_uuid *uuidp, int index, int gen)
                 GOTO(out, rc);
 
         exp_observer = obd->obd_observer->obd_self_export;
-        rc = obd_set_info(exp_observer, strlen("next_id"),"next_id", 2, params);
+        rc = obd_set_info(exp_observer, strlen("next_id"),"next_id",
+                          sizeof(params), params);
         if (rc)
                 GOTO(out, rc);
 
@@ -580,6 +581,9 @@ static void __lov_del_obd(struct obd_device *obd, struct lov_tgt_desc *tgt)
         LASSERT(tgt->reap);
         osc_obd = class_exp2obd(tgt->ltd_exp);
 
+        CDEBUG(D_CONFIG, "Removing tgt %s : %s\n", tgt->uuid.uuid, 
+               osc_obd ? osc_obd->obd_name : "<no obd>");
+
         if (tgt->ltd_exp)
                 lov_disconnect_obd(obd, tgt);
 
index 6a8a485..dbc7c50 100644 (file)
@@ -1058,7 +1058,7 @@ static char *reint_names[] = {
         [REINT_OPEN]    "open",
 };
 
-static int mds_set_info(struct obd_export *exp, struct ptlrpc_request *req)
+static int mds_set_info_rpc(struct obd_export *exp, struct ptlrpc_request *req)
 {
         char *key;
         __u32 *val;
@@ -1297,7 +1297,7 @@ int mds_handle(struct ptlrpc_request *req)
 
         case MDS_SET_INFO:
                 DEBUG_REQ(D_INODE, req, "set_info");
-                rc = mds_set_info(req->rq_export, req);
+                rc = mds_set_info_rpc(req->rq_export, req);
                 break;
 
         case MDS_QUOTACHECK:
@@ -2228,6 +2228,40 @@ static int mds_health_check(struct obd_device *obd)
         return rc;
 }
 
+static int mds_set_info(struct obd_export *exp, obd_count keylen,
+                        void *key, obd_count vallen, void *val)
+{
+        struct obd_device *obd = exp->exp_obd;
+        struct mds_obd *mds = &obd->u.mds;
+        int rc = -EINVAL;
+        ENTRY;
+
+        if (KEY_IS("next_id")) {
+                int idx = (int)*((obd_id*)val);
+                obd_id id = *(((obd_id*)val) + 1);
+                
+                if (vallen != sizeof(obd_id) * 2)
+                        RETURN(-EINVAL);
+                
+                if (idx > mds->mds_lov_desc.ld_tgt_count) 
+                        RETURN(-EINVAL);
+                
+                mds->mds_lov_objids[idx] = id;
+                //mds->mds_lov_objids_valid = 1;
+
+                CWARN("got last object "LPU64" from OST %d\n",
+                      mds->mds_lov_objids[idx], idx);
+
+                rc = mds_lov_write_objids(obd);
+                if (rc)
+                        CERROR("got last objids from OSTs, but error "
+                               "writing objids file: %d\n", rc);
+        }
+        
+        RETURN(rc);
+}
+
+
 struct lvfs_callback_ops mds_lvfs_ops = {
         l_fid2dentry:     mds_lvfs_fid2dentry,
 };
@@ -2251,6 +2285,7 @@ static struct obd_ops mds_obd_ops = {
         .o_llog_finish     = mds_llog_finish,
         .o_notify          = mds_notify,
         .o_health_check    = mds_health_check,
+        .o_set_info        = mds_set_info,
 };
 
 static struct obd_ops mdt_obd_ops = {
index d655273..400d92d 100644 (file)
@@ -494,8 +494,12 @@ static int __mds_lov_syncronize(void *data)
                 GOTO(out, rc);
         }
 
-        CWARN("MDS %s: %s now active, resetting orphans\n",
-              obd->obd_name, uuid ? (char *)uuid->uuid : "All OSC's");
+        if (uuid)
+                CWARN("MDS %s: %s now active, resetting orphans\n",
+                      obd->obd_name, (char *)uuid->uuid);
+        else
+                CWARN("MDS %s: All %d OSC's now active, resetting orphans\n",
+                      obd->obd_name, obd->u.mds.mds_lov_desc.ld_tgt_count);
 
         if (obd->obd_stopping)
                 GOTO(out, rc = -ENODEV);
index 8b1dc1c..85c7dcb 100644 (file)
@@ -583,8 +583,6 @@ static int mgc_process_log(struct obd_device *mgc, char *logname,
         int rc, rcl, flags = 0;
         ENTRY;
 
-        CDEBUG(D_MGC, "parsing config log %s\n", logname);
-
         rctxt = llog_get_context(mgc, LLOG_CONFIG_REPL_CTXT);
         if (!rctxt) {
                 CERROR("missing llog context\n");
@@ -666,7 +664,7 @@ static int mgc_process_config(struct obd_device *obd, obd_count len, void *buf)
                 cfg = (struct config_llog_instance *)lustre_cfg_buf(lcfg, 2);
                 CDEBUG(D_MGC, "parse_log %s from %d\n", logname, 
                        cfg->cfg_last_idx);
-                mgc_process_log(obd, logname, cfg);
+                rc = mgc_process_log(obd, logname, cfg);
                 GOTO(out, rc);
         }
         default: {
index cc5337d..dfbabe9 100644 (file)
@@ -310,10 +310,10 @@ void class_obd_list(void)
                         status = "AT";
                 else
                         status = "--";
-                LCONSOLE_WARN("%3d %s %s %s %s %d\n",
-                              i, status, obd->obd_type->typ_name,
-                              obd->obd_name, obd->obd_uuid.uuid,
-                              atomic_read(&obd->obd_refcount));
+                LCONSOLE(D_WARNING, "%3d %s %s %s %s %d\n",
+                         i, status, obd->obd_type->typ_name,
+                         obd->obd_name, obd->obd_uuid.uuid,
+                         atomic_read(&obd->obd_refcount));
         }
         spin_unlock(&obd_dev_lock);
         return;
index d3e5a34..d51f00d 100644 (file)
@@ -753,7 +753,7 @@ static int class_config_llog_handler(struct llog_handle * handle,
                                 lustre_cfg_string(lcfg, 0),
                                 cfg->cfg_instance);
                         lustre_cfg_bufs_set_string(&bufs, 0, inst_name);
-                        CERROR("cmd %x, instance name: %s\n", 
+                        CDEBUG(D_CONFIG, "cmd %x, instance name: %s\n", 
                                lcfg->lcfg_command, inst_name);
                 }
 
@@ -804,6 +804,10 @@ static int class_config_llog_handler(struct llog_handle * handle,
                 break;
         }
 out:
+        if (rc) {
+                CERROR("Err %d on cfg command:\n", rc);
+                class_config_dump_handler(handle, rec, data);
+        }
         RETURN(rc);
 }
 
@@ -831,8 +835,10 @@ int class_config_parse_llog(struct llog_ctxt *ctxt, char *name,
 
         rc = llog_process(llh, class_config_llog_handler, cfg, &cd);
 
-        CERROR("Processed %d-%d\n", cd.first_idx, cd.last_idx);
-        cfg->cfg_last_idx = cd.last_idx;
+        CDEBUG(D_CONFIG|D_ERROR, "Processed log %s gen %d-%d (%d)\n", name, 
+               cd.first_idx, cd.last_idx, rc);
+        if (cfg)
+                cfg->cfg_last_idx = cd.last_idx;
 
 parse_out:
         rc2 = llog_close(llh);
@@ -892,11 +898,11 @@ int class_config_dump_handler(struct llog_handle * handle,
                                                 lustre_cfg_string(lcfg, i));
                         }
                 }
-                LCONSOLE_INFO("   %s\n", outstr);
+                LCONSOLE(D_WARNING, "   %s\n", outstr);
         } else if (rec->lrh_type == PTL_CFG_REC) {
-                LCONSOLE_INFO("Obsolete pcfg command\n");
+                LCONSOLE(D_WARNING, "Obsolete pcfg command\n");
         } else {
-                LCONSOLE_INFO("unhandled lrh_type: %#x\n", rec->lrh_type);
+                LCONSOLE(D_WARNING, "unhandled lrh_type: %#x\n", rec->lrh_type);
                 rc = -EINVAL;
         }
 out:
index 11161f8..f93e398 100644 (file)
@@ -26,6 +26,8 @@
 
 #define DEBUG_SUBSYSTEM S_MGMT
 #define D_MOUNT D_SUPER|D_CONFIG|D_ERROR
+#define PRINT_CMD LCONSOLE
+#define PRINT_MASK D_WARNING
 
 #include <linux/obd.h>
 #include <linux/lvfs.h>
@@ -94,6 +96,10 @@ static int server_register_mount(char *name, struct super_block *sb,
         list_add(&lmi->lmi_list_chain, &server_mount_info_list);
          
         up(&lustre_mount_info_lock);
+
+        CDEBUG(D_MOUNT, "reg_mnt %p from %s, vfscount=%d\n", 
+               lmi->lmi_mnt, name, atomic_read(&lmi->lmi_mnt->mnt_count));
+
         return 0;
 }
 
@@ -109,10 +115,15 @@ static int server_deregister_mount(char *name)
                 CERROR("%s not registered\n", name);
                 return -ENOENT;
         }
+        
+        CDEBUG(D_MOUNT, "dereg_mnt %p from %s, vfscount=%d\n", 
+               lmi->lmi_mnt, name, atomic_read(&lmi->lmi_mnt->mnt_count));
+        
         OBD_FREE(lmi->lmi_name, strlen(lmi->lmi_name) + 1);
         list_del(&lmi->lmi_list_chain);
         OBD_FREE(lmi, sizeof(*lmi));
         up(&lustre_mount_info_lock);
+
         return 0;
 }
 
@@ -161,8 +172,9 @@ struct lustre_mount_info *server_get_mount(char *name)
         
         up(&lustre_mount_info_lock);
         
-        CDEBUG(D_MOUNT, "get_mnt %p from %s, vfscount=%d\n", 
-               lmi->lmi_mnt, name, atomic_read(&lmi->lmi_mnt->mnt_count));
+        CDEBUG(D_MOUNT, "get_mnt %p from %s, refs=%d, vfscount=%d\n", 
+               lmi->lmi_mnt, name, atomic_read(&lsi->lsi_mounts),
+               atomic_read(&lmi->lmi_mnt->mnt_count));
 
         return lmi;
 }
@@ -191,10 +203,6 @@ int server_put_mount(char *name, struct vfsmount *mnt)
                 CERROR("Can't find mount for %s\n", name);
                 return -ENOENT;
         }
-
-        CDEBUG(D_MOUNT, "put_mnt %p from %s, vfscount=%d\n", 
-               lmi->lmi_mnt, name, atomic_read(&lmi->lmi_mnt->mnt_count));
-
         lsi = s2lsi(lmi->lmi_sb);
         LASSERT(lmi->lmi_mnt == mnt);
         unlock_mntput(lmi->lmi_mnt);
@@ -204,11 +212,15 @@ int server_put_mount(char *name, struct vfsmount *mnt)
                        atomic_read(&lmi->lmi_mnt->mnt_count));
                 /* last mount is the One True Mount */
                 if (atomic_read(&lmi->lmi_mnt->mnt_count) > 1)
-                        CERROR("%s: mount busy, vfscount=%d\n", name,
+                        CERROR("%s: mount busy, vfscount=%d!\n", name,
                                atomic_read(&lmi->lmi_mnt->mnt_count));
         }
         up(&lustre_mount_info_lock);
 
+        CDEBUG(D_MOUNT, "put_mnt %p from %s, refs=%d, vfscount=%d\n", 
+               lmi->lmi_mnt, name, atomic_read(&lsi->lsi_mounts),
+               atomic_read(&lmi->lmi_mnt->mnt_count));
+
         /* this obd should never need the mount again */
         server_deregister_mount(name);
         
@@ -222,18 +234,18 @@ static void ldd_print(struct lustre_disk_data *ldd)
 {
         int i;
 
-        LCONSOLE_WARN("  disk data:\n"); 
-        LCONSOLE_WARN("config:  %d\n", ldd->ldd_config_ver);
-        LCONSOLE_WARN("fs:      %s\n", ldd->ldd_fsname);
-        LCONSOLE_WARN("server:  %s\n", ldd->ldd_svname);
-        LCONSOLE_WARN("index:   %04x\n", ldd->ldd_svindex);
-        LCONSOLE_WARN("flags:   %#x\n", ldd->ldd_flags);
-        LCONSOLE_WARN("diskfs:  %s\n", MT_STR(ldd));
-        LCONSOLE_WARN("options: %s\n", ldd->ldd_mount_opts);
+        PRINT_CMD(PRINT_MASK, "  disk data:\n"); 
+        PRINT_CMD(PRINT_MASK, "config:  %d\n", ldd->ldd_config_ver);
+        PRINT_CMD(PRINT_MASK, "fs:      %s\n", ldd->ldd_fsname);
+        PRINT_CMD(PRINT_MASK, "server:  %s\n", ldd->ldd_svname);
+        PRINT_CMD(PRINT_MASK, "index:   %04x\n", ldd->ldd_svindex);
+        PRINT_CMD(PRINT_MASK, "flags:   %#x\n", ldd->ldd_flags);
+        PRINT_CMD(PRINT_MASK, "diskfs:  %s\n", MT_STR(ldd));
+        PRINT_CMD(PRINT_MASK, "options: %s\n", ldd->ldd_mount_opts);
         if (!ldd->ldd_mgsnid_count) 
-                LCONSOLE_WARN("no MGS nids\n");
+                PRINT_CMD(PRINT_MASK, "no MGS nids\n");
         else for (i = 0; i < ldd->ldd_mgsnid_count; i++) {
-                LCONSOLE_WARN("mgs nid %d:  %s\n", i, 
+                PRINT_CMD(PRINT_MASK, "mgs nid %d:  %s\n", i, 
                        libcfs_nid2str(ldd->ldd_mgsnid[i]));
         }
 }
@@ -405,7 +417,7 @@ static int config_log_add(char *name)
         int rc;
         ENTRY;
 
-        CDEBUG(D_MOUNT, "adding config llog %s\n", name);
+        CDEBUG(D_MOUNT, "adding config log %s\n", name);
         if (config_log_get(name)) {
                 GOTO(out, rc = -EEXIST);
         }
@@ -447,7 +459,7 @@ int config_log_end(char *name)
         OBD_FREE(cld, sizeof(*cld));
 out:
         config_log_put();
-        CDEBUG(D_MOUNT, "removed config llog %s %d\n", name, rc);
+        CDEBUG(D_MOUNT, "dropping config log %s (%d)\n", name, rc);
         RETURN(rc);
 }
 
@@ -1370,10 +1382,13 @@ static int server_fill_super(struct super_block *sb)
         RETURN(0);
 
 out_mnt:
+        server_put_super(sb);
+#if 0
         if (mgs_service)
                 server_stop_mgs(sb);
         /* mgc is stopped in lustre_fill_super */
         unlock_mntput(mnt);
+#endif
 out:
         //if (lsi->lsi_ldd) class_del_profile(lsi->lsi_ldd->ldd_svname);
         RETURN(rc);
@@ -1406,20 +1421,20 @@ static void lmd_print(struct lustre_mount_data *lmd)
 {
         int i;
 
-        LCONSOLE_WARN("  mount data:\n"); 
+        PRINT_CMD(PRINT_MASK, "  mount data:\n"); 
         if (!lmd->lmd_mgsnid_count) 
-                LCONSOLE_WARN("no MGS nids\n");
+                PRINT_CMD(PRINT_MASK, "no MGS nids\n");
         else for (i = 0; i < lmd->lmd_mgsnid_count; i++) {
-                LCONSOLE_WARN("nid %d:  %s\n", i, 
+                PRINT_CMD(PRINT_MASK, "nid %d:  %s\n", i, 
                        libcfs_nid2str(lmd->lmd_mgsnid[i]));
         }
         if (lmd_is_client(lmd)) 
-                LCONSOLE_WARN("fsname:  %s\n", lmd->lmd_dev);
+                PRINT_CMD(PRINT_MASK, "fsname:  %s\n", lmd->lmd_dev);
         else
-                LCONSOLE_WARN("device:  %s\n", lmd->lmd_dev);
-        LCONSOLE_WARN("flags:   %x\n", lmd->lmd_flags);
+                PRINT_CMD(PRINT_MASK, "device:  %s\n", lmd->lmd_dev);
+        PRINT_CMD(PRINT_MASK, "flags:   %x\n", lmd->lmd_flags);
         if (lmd->lmd_opts)
-                LCONSOLE_WARN("options: %s\n", lmd->lmd_opts);
+                PRINT_CMD(PRINT_MASK, "options: %s\n", lmd->lmd_opts);
 }
 
 static int lmd_parse(char *options, struct lustre_mount_data *lmd)
index 3c7a3a7..5b82ddc 100755 (executable)
@@ -55,3 +55,8 @@ if [ `egrep -c "lustre|lnet" $MODFILE` -eq 0 ]; then
     echo "alias lustre llite" >> $MODFILE
     echo "# end Lustre modules" >> $MODFILE
 fi
+
+#  To generate gdb debug file:
+# modprobe lustre; modprobe mds; modprobe obdfilter; modprobe mgs; modprobe mgc
+# rm -f /r/tmp/ogdb-`hostname`
+# ./lctl modules > /r/tmp/ogdb-`hostname`