Whamcloud - gitweb
Branch b1_4_mountconf
authornathan <nathan>
Mon, 27 Feb 2006 22:16:41 +0000 (22:16 +0000)
committernathan <nathan>
Mon, 27 Feb 2006 22:16:41 +0000 (22:16 +0000)
b=9846
add global lctl set_timeout

lustre/mds/mds_lov.c
lustre/mgs/mgs_handler.c
lustre/mgs/mgs_llog.c
lustre/obdclass/obd_config.c
lustre/obdclass/obd_mount.c
lustre/tests/recovery-small.sh
lustre/tests/replay-single.sh
lustre/tests/test-framework.sh
lustre/utils/lustre_cfg.c
lustre/utils/obd.c

index 95f2e93..1920c9c 100644 (file)
@@ -247,9 +247,6 @@ static int mds_lov_add_ost(struct obd_device *obd, struct obd_device *watched,
         int rc = 0;
         ENTRY;
 
-        //FIXME remove D_WARNING
-        CDEBUG(D_CONFIG|D_WARNING, "Updating mds lov for OST idx %d\n", idx);
-
         old_count = mds->mds_lov_desc.ld_tgt_count;
         rc = mds_lov_update_desc(obd, mds->mds_osc_exp);
         if (rc)
@@ -271,8 +268,6 @@ static int mds_lov_add_ost(struct obd_device *obd, struct obd_device *watched,
                 if (rc)
                         RETURN(rc);
                 mds->mds_lov_objids[idx] = lastid;
-                CWARN("got last object "LPU64" from OST %d\n",
-                      mds->mds_lov_objids[idx], idx);
                 mds->mds_lov_objids_dirty = 1;
                 mds_lov_write_objids(obd);
         } else {
@@ -280,9 +275,8 @@ static int mds_lov_add_ost(struct obd_device *obd, struct obd_device *watched,
                 rc = mds_lov_set_nextid(obd);
         }
 
-        CWARN("last object "LPU64" from OST %d\n",
+        CDEBUG(D_CONFIG, "last object "LPU64" from OST %d\n",
               mds->mds_lov_objids[idx], idx);
-        
 
         /* These two must be atomic */
         down(&mds->mds_orphan_recovery_sem);
index 5923980..8ffd4f5 100644 (file)
@@ -564,12 +564,11 @@ int mgs_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
 
         switch (cmd) {
 
-        case OBD_IOC_DORECORD: 
         case OBD_IOC_PARAM: {
                 struct lustre_handle lockh;
                 struct lustre_cfg *lcfg;
                 struct llog_rec_hdr rec;
-                char fsname[32], *devname, *ptr;
+                char fsname[32], *devname;
                 int lockrc;
 
                 CERROR("MGS param\n");
@@ -594,26 +593,22 @@ int mgs_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                         GOTO(out_free, rc = -EINVAL);
 
                 /* Extract fsname */
-                /* FIXME COMPAT_146 this won't work with old names */
                 memset(fsname, 0, sizeof(fsname));
                 devname = lustre_cfg_string(lcfg, 0);
-                if (!devname) {
-                        LCONSOLE_ERROR("No device specified\n");
-                        GOTO(out_free, rc = -ENODEV);
-                }
-                ptr = strchr(devname, '-');
-                if (!ptr) {
-                        /* assume devname is the fsname */
-                        //strncpy(fsname, devname, sizeof(fsname));
-                        LCONSOLE_ERROR("Unrecognized device %s\n", devname);
-                        GOTO(out_free, rc = -ENODEV);
-                } else {  
-                        strncpy(fsname, devname, ptr - devname);
+                if (devname) {
+                        char *ptr = strchr(devname, '-');
+                        if (!ptr) {
+                                /* assume devname is the fsname */
+                                strncpy(fsname, devname, sizeof(fsname));
+                        } else {  
+                                strncpy(fsname, devname, ptr - devname);
+                        }
+                        CDEBUG(D_MGS, "set param on fs %s device %s\n", 
+                               fsname, devname);
+                } else {
+                        CDEBUG(D_MGS, "set global param\n");
                 }
 
-                CDEBUG(D_MGS, "set param on fs %s device %s\n", 
-                       fsname, devname);
-
                 rc = mgs_setparam(obd, fsname, lcfg);
                 if (rc) {
                         CERROR("setparam err %d\n", rc);
@@ -624,11 +619,14 @@ int mgs_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                    someone was already reading while we were updating the logs,
                    so we don't really need to hold the lock while we're
                    writing (above). */
-                lockrc = mgs_get_cfg_lock(obd, fsname, &lockh);
-                if (lockrc != ELDLM_OK) 
-                        CERROR("lock error %d for fs %s\n", lockrc, fsname);
-                else
-                        mgs_put_cfg_lock(&lockh);
+                if (fsname) {
+                        lockrc = mgs_get_cfg_lock(obd, fsname, &lockh);
+                        if (lockrc != ELDLM_OK) 
+                                CERROR("lock error %d for fs %s\n", lockrc, 
+                                       fsname);
+                        else
+                                mgs_put_cfg_lock(&lockh);
+                }
 out_free:
                 OBD_FREE(lcfg, data->ioc_plen1);
                 RETURN(rc);
index 518b101..eeed64f 100644 (file)
@@ -648,11 +648,6 @@ static int mgs_write_log_direct(struct obd_device *obd, struct fs_db *fsdb,
         int rc;
         ENTRY;
 
-        if (mgs_log_is_empty(obd, logname)) {
-                CERROR("%s log is empty\n", logname);
-                RETURN(-ENODEV);
-        }
-
         rc = record_start_log(obd, &llh, logname);
         rc = record_marker(obd, llh, fsdb, CM_START, obdname, "param"); 
         
@@ -1243,6 +1238,45 @@ int mgs_erase_logs(struct obd_device *obd, char *fsname)
         RETURN(rc);
 }
 
+/* erase all logs for the given fs */
+int mgs_setparam_all_logs(struct obd_device *obd, struct fs_db *fsdb,
+                          char *fsname, struct lustre_cfg *lcfg)
+{
+        struct mgs_obd *mgs = &obd->u.mgs;
+        struct list_head dentry_list;
+        struct l_linux_dirent *dirent, *n;
+        char *logname;
+        int rc, len = strlen(fsname);
+        ENTRY;
+        
+        /* We need to set params for any future logs 
+           as well. FIXME Append this file to every new log. */
+        name_create(fsname, "-params", &logname);
+        rc = mgs_write_log_direct(obd, fsdb, logname, logname, lcfg);
+        name_destroy(logname);
+
+        /* Find all the logs in the CONFIGS directory */
+        rc = dentry_readdir(obd, mgs->mgs_configs_dir,
+                             mgs->mgs_vfsmnt, &dentry_list);
+        if (rc) {
+                CERROR("Can't read %s dir\n", MOUNT_CONFIGS_DIR);
+                RETURN(rc);
+        }
+                                                                                
+        /* Could use fsdb index maps instead */
+        list_for_each_entry_safe(dirent, n, &dentry_list, lld_list) {
+                list_del(&dirent->lld_list);
+                if (strncmp(fsname, dirent->lld_name, len) == 0) {
+                        CDEBUG(D_MGS, "Changing log %s\n", dirent->lld_name);
+                        rc = mgs_write_log_direct(obd, fsdb, dirent->lld_name,
+                                                  dirent->lld_name, lcfg);
+                }
+                OBD_FREE(dirent, sizeof(*dirent));
+        }
+        
+        RETURN(rc);
+}
+
 /* from llog_swab */
 static void print_lustre_cfg(struct lustre_cfg *lcfg)
 {
@@ -1277,7 +1311,7 @@ int mgs_setparam(struct obd_device *obd, char *fsname, struct lustre_cfg *lcfg)
 
         print_lustre_cfg(lcfg);
         
-        /* lustre-mdtlov, lustre-client, lustre-MDT0000 */
+        /* lustre, lustre-mdtlov, lustre-client, lustre-MDT0000 */
         devname = lustre_cfg_string(lcfg, 0);
 
         if (devname == NULL) {
@@ -1288,32 +1322,6 @@ int mgs_setparam(struct obd_device *obd, char *fsname, struct lustre_cfg *lcfg)
         
         CDEBUG(D_MGS, "target: %s\n", devname);
 
-#if 0
-        struct mgs_target_info *mti;
-        unsigned long index;
-        rc = server_name2index(devname, &index, NULL);
-        if (rc < 0) 
-                /* Might be lov */
-                CDEBUG(D_MGS, "Can't find index for %s\n", devname);
-        else {
-                /* Construct a fake mti out of the target name */
-                OBD_ALLOC_PTR(mti);
-                if (!mti) 
-                        RETURN(-ENOMEM);
-                strncpy(mti->mti_svname, devname, sizeof(mti->mti_svname));
-                memcpy(mti->mti_fsname, fsname, sizeof(mti->mti_fsname));
-                mti->mti_flags = rc; /* rc from name2index is obd type */
-                mti->mti_stripe_index = index;
-                rc = mgs_check_index(obd, mti);
-                if (rc != 1) {
-                        CERROR("Target %s has not registered yet.\n",
-                               mti->mti_svname);
-                        rc = -ENODEV;
-                } 
-                OBD_FREE_PTR(mti);
-        }
-#endif
-
         rc = mgs_find_or_make_fsdb(obd, fsname, &fsdb); 
         if (rc) 
                 RETURN(rc);
@@ -1322,23 +1330,29 @@ int mgs_setparam(struct obd_device *obd, char *fsname, struct lustre_cfg *lcfg)
                 RETURN(-EINVAL);
         }
 
+        down(&fsdb->fsdb_sem);
+        
         /* It's all special cases */
 
         /* lustre-mdtlov, old lov_mdsA. */
-        if (strstr(devname, "-mdtlov")
-            /* COMPAT_146 */ || (strncmp(devname, "lov_", 4) == 0)) {
+        if (strstr(devname, "-mdtlov")) {
                 char *lovname, *logname;
                 CDEBUG(D_MGS, "lov param, mod MDT and client\n");
-                down(&fsdb->fsdb_sem);
                 name_create(fsname, "-MDT0000", &logname);
                 name_create(fsname, "-mdtlov", &lovname);
                 if (strcmp(lovname, devname) != 0) {
                         CWARN("weird/old lovname %s, hope you're right\n",
                               devname);
                 }
-                rc = mgs_write_log_direct(obd, fsdb, logname, devname, lcfg);
+                if (mgs_log_is_empty(obd, logname)) 
+                        rc = -ENODEV;
+                else
+                        rc = mgs_write_log_direct(obd, fsdb, logname, devname, 
+                                                  lcfg);
                 name_destroy(lovname);
                 name_destroy(logname);
+                if (rc) 
+                        GOTO(out, rc);
                 name_create(fsname, "-client", &logname);
                 name_create(fsname, "-clilov", &lovname);
                 /* Now, we still have to fix the devname (from the mdtlov
@@ -1352,9 +1366,15 @@ int mgs_setparam(struct obd_device *obd, char *fsname, struct lustre_cfg *lcfg)
                 }
                 name_destroy(lovname);
                 name_destroy(logname);
-                up(&fsdb->fsdb_sem);
         }
 
+        if (lcfg->lcfg_command == LCFG_SET_TIMEOUT) {
+                CDEBUG(D_MGS, "timeout, mod MDT, OSTs, client\n");
+                rc = mgs_setparam_all_logs(obd, fsdb, fsname, lcfg); 
+        }
+
+out:
+        up(&fsdb->fsdb_sem);
         RETURN(rc);
 }
 
index bc68880..41bcaa9 100644 (file)
@@ -726,8 +726,7 @@ static int class_config_llog_handler(struct llog_handle * handle,
         int rc = 0;
         ENTRY;
         
-        // FIXME remove
-        class_config_dump_handler(handle, rec, data);
+        //class_config_dump_handler(handle, rec, data);
 
         switch (rec->lrh_type) {
         case OBD_CFG_REC: {
@@ -748,22 +747,20 @@ static int class_config_llog_handler(struct llog_handle * handle,
                 /* Figure out config state info */
                 if (lcfg->lcfg_command == LCFG_MARKER) {
                         struct cfg_marker *marker = lustre_cfg_buf(lcfg, 1);
-                        CDEBUG(D_CONFIG|D_WARNING, "Marker, cfg_flg=%#x\n",
+                        CDEBUG(D_CONFIG, "Marker, cfg_flg=%#x\n",
                                cfg->cfg_flags);
                         if (marker->cm_flags & CM_START) {
                                 /* all previous flags off */
                                 cfg->cfg_flags = CFG_F_MARKER;
                                 if (marker->cm_flags & CM_SKIP) { 
                                         cfg->cfg_flags |= CFG_F_SKIP;
-                                        // FIXME warning
-                                        CDEBUG(D_CONFIG|D_WARNING, "SKIP #%d\n",
+                                        CDEBUG(D_CONFIG, "SKIP #%d\n",
                                                marker->cm_step);
                                 } else if (lustre_check_exclusion(cfg->cfg_sb, 
                                                           marker->cm_svname)) {
                                         cfg->cfg_flags |= CFG_F_EXCLUDE;
-                                        // FIXME warning
-                                        CDEBUG(D_CONFIG|D_WARNING,
-                                               "EXCLUDE %d\n", marker->cm_step);
+                                        CDEBUG(D_CONFIG, "EXCLUDE %d\n",
+                                               marker->cm_step);
                                 }
                         } else if (marker->cm_flags & CM_END) {
                                 cfg->cfg_flags = 0;
index 413e791..2844768 100644 (file)
@@ -701,8 +701,6 @@ static int lustre_stop_mgc(struct super_block *sb)
                 /* FIXME maybe always set this? */
                 obd->obd_no_recov = 1;
         }
-        CERROR("force:%d fail:%d no_recov:%d\n", obd->obd_force, obd->obd_fail,
-               obd->obd_no_recov);
 
         if (obd->u.cli.cl_mgc_mgsexp)
                 obd_disconnect(obd->u.cli.cl_mgc_mgsexp);
@@ -1256,7 +1254,7 @@ static void server_put_super(struct super_block *sb)
            is right. */
         server_stop_servers(lddflags, lsiflags);
 
-        CDEBUG(D_MOUNT, "umount done\n");
+        CDEBUG(D_MOUNT|D_WARNING, "umount done\n");
         EXIT;
 }
 
index ecf3719..4dade7d 100755 (executable)
@@ -20,7 +20,7 @@ build_test_filter
 # setting SETUP=" " and CLEANUP=" "
 SETUP=${SETUP:-"setup"}
 CLEANUP=${CLEANUP:-"cleanup"}
-FORCE=${FORCE:-"--force"}
+FORCE=${FORCE:-"-f"}
 
 make_config() {
     rm -f $XMLCONFIG
index f67c2e4..6528fee 100755 (executable)
@@ -37,8 +37,8 @@ cleanup() {
 
 if [ "$ONLY" == "cleanup" ]; then
     sysctl -w lnet.debug=0 || true
-    # force is the default, '-f' is failover
-    FORCE=""
+    # failover is the default, '-f' is force
+    FORCE="-f"
     exit
 fi
 
@@ -47,9 +47,9 @@ CLEANUP=${CLEANUP:-"cleanup"}
 
 setup() {
     grep " $MOUNT " /proc/mounts && zconf_umount `hostname` $MOUNT
-    stop ost || 1
-    stop ost2 || 1
-    stop mds || 1
+    stop ost -f || 1
+    stop ost2 -f || 1
+    stop mds -f || 1
     add mds $MDS_MKFS_OPTS --reformat $MDSDEV
     add ost $OST_MKFS_OPTS --reformat $OSTDEV
     add ost2 $OST2_MKFS_OPTS --reformat $OSTDEV2
index 25cb02f..150e128 100644 (file)
@@ -92,10 +92,10 @@ start() {
 
 stop() {
     facet=$1
-    force=$2
+    shift
     active=`facet_active $facet`
     echo "umount active=${active}, facet=${facet}"
-    do_facet ${facet} umount -d $force /mnt/${facet}
+    do_facet ${facet} umount -d $@ /mnt/${facet}
     #do_facet $facet $LCONF --select ${facet}_svc=${active}_facet \
     #    --node ${active}_facet  --ptldebug $PTLDEBUG --subsystem $SUBSYSTEM \
     #    $@ --cleanup $XMLCONFIG
@@ -134,7 +134,7 @@ shutdown_facet() {
        $POWER_DOWN `facet_active_host $facet`
        sleep 2 
     elif [ "$FAILURE_MODE" = SOFT ]; then
-       stop $facet -f
+       stop $facet
     fi
 }
 
@@ -224,7 +224,7 @@ fail() {
 
 fail_abort() {
     local facet=$1
-    stop $facet --force --failover --nomod
+    stop $facet
     change_active $facet
     start $*
     do_facet $facet lctl --device %${facet}_svc abort_recovery
@@ -361,7 +361,7 @@ add() {
     local facet=$1
     shift
     # failsafe
-    umount -d /mnt/${facet} || true
+    umount -d -f /mnt/${facet} || true
     rm -f ${facet}active
     mkfs.lustre $*
 }
index fb5fcde..0dabd73 100644 (file)
@@ -540,7 +540,9 @@ int jt_lcfg_set_timeout(int argc, char **argv)
         lcfg = lustre_cfg_new(LCFG_SET_TIMEOUT, &bufs);
         lcfg->lcfg_num = atoi(argv[1]);
         
-        rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
+        //rc = lcfg_ioctl(argv[0], OBD_DEV_ID, lcfg);
+        rc = lcfg_mgs_ioctl(argv[0], OBD_DEV_ID, lcfg);
+
         lustre_cfg_free(lcfg);
         if (rc < 0) {
                 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
@@ -712,13 +714,6 @@ int jt_lcfg_mgsparam(int argc, char **argv)
         if (rc < 0) {
                 fprintf(stderr, "error: %s: %s\n", jt_cmdname(argv[0]),
                         strerror(rc = errno));
-                if (rc == ENODEV) 
-                        fprintf(stderr, "Is the MGS running on this node?\n");
-                if (rc == ENOSYS) 
-                        fprintf(stderr, "Make sure cfg_device is set first.\n");
-                if (rc == EINVAL) 
-                        fprintf(stderr, "cfg_device should be of the form "
-                                "'lustre-MDT0000'\n");
         }
         
         return rc;
index 4a78e49..1184ffd 100644 (file)
@@ -180,6 +180,14 @@ int lcfg_mgs_ioctl(char *func, int dev_id, struct lustre_cfg *lcfg)
 
         rc =  l_ioctl(dev_id, OBD_IOC_PARAM, buf);
 
+        if (rc == ENODEV) 
+                fprintf(stderr, "Is the MGS running on this node?\n");
+        if (rc == ENOSYS) 
+                fprintf(stderr, "Make sure cfg_device is set first.\n");
+        if (rc == EINVAL) 
+                fprintf(stderr, "cfg_device should be of the form "
+                        "'lustre-MDT0000'\n");
+
         return rc;
 }