Whamcloud - gitweb
b=2264
authorjacob <jacob>
Wed, 10 Mar 2004 22:28:29 +0000 (22:28 +0000)
committerjacob <jacob>
Wed, 10 Mar 2004 22:28:29 +0000 (22:28 +0000)
r=robert

overwrite log when running lconf --write_conf

lustre/ChangeLog
lustre/include/linux/lustre_lib.h
lustre/mds/mds_fs.c
lustre/mds/mds_lov.c
lustre/utils/lconf
lustre/utils/lctl.c
lustre/utils/obd.c
lustre/utils/obdctl.h

index d233e0c..4209127 100644 (file)
@@ -7,6 +7,7 @@ tbd  Cluster File Systems, Inc. <info@clusterfs.com>
        - del obd_self_export from work_list in class_disconnect_exports (2908)
        - don't LBUG if MDS recovery times out during orphan cleanup (2530)
        - fix destroying of named logs (2325)
+       - overwrite old logs when running lconf --write_conf (2264)
 
 2004-03-04  Cluster File Systems, Inc. <info@clusterfs.com>
        * version 1.2.0
index 4eef3be..24ad8fb 100644 (file)
@@ -441,6 +441,7 @@ static inline void obd_ioctl_freedata(char *buf, int len)
 #define OBD_IOC_DORECORD               _IOWR('f', 183, long)
 #define OBD_IOC_PROCESS_CFG            _IOWR('f', 184, long)
 #define OBD_IOC_DUMP_LOG               _IOWR('f', 185, long)
+#define OBD_IOC_CLEAR_LOG              _IOWR('f', 186, long)
 
 #define OBD_IOC_CATLOGLIST             _IOWR('f', 190, long)
 #define OBD_IOC_LLOG_INFO              _IOWR('f', 191, long)
index d3e235a..6c69bd4 100644 (file)
@@ -643,7 +643,7 @@ int mds_obd_destroy(struct obd_export *exp, struct obdo *oa,
         de = lookup_one_len(fidname, mds->mds_objects_dir, namelen);
         if (de == NULL || de->d_inode == NULL) {
                 CERROR("destroying non-existent object "LPU64"\n", oa->o_id);
-                GOTO(out, rc = IS_ERR(de) ? PTR_ERR(de) : -ENOENT);
+                GOTO(out_dput, rc = IS_ERR(de) ? PTR_ERR(de) : -ENOENT);
         }
 
         handle = fsfilt_start(obd, mds->mds_objects_dir->d_inode,
@@ -661,8 +661,8 @@ int mds_obd_destroy(struct obd_export *exp, struct obdo *oa,
         if (err && !rc)
                 rc = err;
 out_dput:
-        l_dput(de);
-out:
+        if (de != NULL)
+                l_dput(de);
         up(&parent_inode->i_sem);
         pop_ctxt(&saved, &obd->obd_ctxt, NULL);
         RETURN(rc);
index c6b6839..507ab7e 100644 (file)
@@ -385,6 +385,27 @@ int mds_iocontrol(unsigned int cmd, struct obd_export *exp, int len,
                 RETURN(rc);
         }
 
+        case OBD_IOC_CLEAR_LOG: {
+                char *name = data->ioc_inlbuf1;
+                if (mds->mds_cfg_llh)
+                        RETURN(-EBUSY);
+
+                push_ctxt(&saved, &obd->obd_ctxt, NULL);
+                rc = llog_create(llog_get_context(obd, LLOG_CONFIG_ORIG_CTXT), 
+                                 &mds->mds_cfg_llh, NULL, name);
+                if (rc == 0) {
+                        llog_init_handle(mds->mds_cfg_llh, LLOG_F_IS_PLAIN,
+                                         NULL);
+
+                        rc = llog_destroy(mds->mds_cfg_llh);
+                        llog_free_handle(mds->mds_cfg_llh);
+                }
+                pop_ctxt(&saved, &obd->obd_ctxt, NULL);
+
+                mds->mds_cfg_llh = NULL;
+                RETURN(rc);
+        }
+
         case OBD_IOC_DORECORD: {
                 char *cfg_buf;
                 struct llog_rec_hdr rec;
index 30f8437..322e1f1 100755 (executable)
@@ -399,6 +399,15 @@ class LCTLInterface:
         return rc, out
 
             
+    def clear_log(self, dev, log):
+        """ clear an existing log """
+        cmds =  """
+  device $%s
+  probe
+  clear_log %s
+  quit """ % (dev, log)
+        self.run(cmds)
+
     def network(self, net, nid):
         """ set mynid """
         cmds =  """
@@ -1459,12 +1468,14 @@ class MDSDEV(Module):
             client = VOSC(self.db.lookup(obd_uuid), client_uuid, self.name,
                           self.name)
             config.record = 1
+            lctl.clear_log(self.name, self.name)
             lctl.record(self.name, self.name)
             client.prepare()
             lctl.mount_option(self.name, client.get_name(), "")
             lctl.end_record()
 
             config.cleanup = 1
+            lctl.clear_log(self.name, self.name + '-clean')
             lctl.record(self.name, self.name + '-clean')
             client.cleanup()
             lctl.del_mount_option(self.name)
@@ -2656,6 +2667,7 @@ def main():
     if config.record:
         if not (config.record_device and config.record_log):
             panic("When recording, both --record_log and --record_device must be specified.")
+        lctl.clear_log(config.record_device, config.record_log)
         lctl.record(config.record_device, config.record_log)
 
     doHost(db, node_list)
index c9d69aa..b1c8ca5 100644 (file)
@@ -164,6 +164,8 @@ command_t cmdlist[] = {
          "usage: parse config-uuid-name"},
         {"dump_log", jt_cfg_dump_log, 0, "print log of recorded commands for this config to kernel debug log\n"
          "usage: dump_log config-uuid-name"},
+        {"clear_log", jt_cfg_clear_log, 0, "delete current config log of recorded commands\n"
+         "usage: clear_log config-name"},
 
         /* Device operations */
         {"=== device operations ==", jt_noop, 0, "device operations"},
index e4ef0a8..3a4089a 100644 (file)
@@ -1765,6 +1765,29 @@ int jt_cfg_dump_log(int argc, char **argv)
         return rc;
 }
 
+int jt_cfg_clear_log(int argc, char **argv)
+{
+        struct obd_ioctl_data data;
+        int rc;
+
+        IOC_INIT(data);
+
+        if (argc != 2)
+                return CMD_HELP;
+
+        data.ioc_inllen1 = strlen(argv[1]) + 1;
+        data.ioc_inlbuf1 = argv[1];
+
+        IOC_PACK(argv[0], data);
+        rc = l_ioctl(OBD_DEV_ID, OBD_IOC_CLEAR_LOG, buf);
+        if (rc < 0)
+                fprintf(stderr, "OBD_IOC_CLEAR_LOG failed: %s\n",
+                        strerror(errno));
+
+        return rc;
+}
+
+
 
 int jt_cfg_endrecord(int argc, char **argv)
 {
index b813795..15067d8 100644 (file)
@@ -78,6 +78,7 @@ int jt_cfg_record(int argc, char **argv);
 int jt_cfg_endrecord(int argc, char **argv);
 int jt_cfg_parse(int argc, char **argv);
 int jt_cfg_dump_log(int argc, char **argv);
+int jt_cfg_clear_log(int argc, char **argv);
 
 int jt_llog_catlist(int argc, char **argv);
 int jt_llog_info(int argc, char **argv);