diff --git a/lustre/ChangeLog b/lustre/ChangeLog index d233e0cf2bcf23be10e27c3a36edf3c9defdd29f..42091272c2487f323e9b7cc0138762af9fb1f7d7 100644 --- a/lustre/ChangeLog +++ b/lustre/ChangeLog @@ -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 diff --git a/lustre/include/linux/lustre_lib.h b/lustre/include/linux/lustre_lib.h index 4eef3bee1c1d53c687588e09d8143b3aa96d4386..24ad8fb809d4ece9492fb044d79ef2fd2c8f1522 100644 --- a/lustre/include/linux/lustre_lib.h +++ b/lustre/include/linux/lustre_lib.h @@ -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) diff --git a/lustre/mds/mds_fs.c b/lustre/mds/mds_fs.c index d3e235a9b358b6af3389def2ed34a08ba90f8565..6c69bd41da047a1fba355844fb129fed8872c7ed 100644 --- a/lustre/mds/mds_fs.c +++ b/lustre/mds/mds_fs.c @@ -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); diff --git a/lustre/mds/mds_lov.c b/lustre/mds/mds_lov.c index c6b68395056af27ea816b5da349e86c2019f3b93..507ab7e91eaa82fc91e850028a2fe2c14e2c4ea9 100644 --- a/lustre/mds/mds_lov.c +++ b/lustre/mds/mds_lov.c @@ -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; diff --git a/lustre/utils/lconf b/lustre/utils/lconf index 30f843777e0ebf9a796928179dea0b461b6b0484..322e1f1e428cf028e3000b9290a3bc41c9e0fb4e 100755 --- a/lustre/utils/lconf +++ b/lustre/utils/lconf @@ -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) diff --git a/lustre/utils/lctl.c b/lustre/utils/lctl.c index c9d69aa9cd713f2ae9bb01a40d5c509b77c1ccae..b1c8ca5a87374f7632eb134a03bbdf95d72f89f1 100644 --- a/lustre/utils/lctl.c +++ b/lustre/utils/lctl.c @@ -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"}, diff --git a/lustre/utils/obd.c b/lustre/utils/obd.c index e4ef0a853028b0207c3ccb42d0aadda4b72b79d0..3a4089a4ec115a089b700ca6366a531ec0a57af5 100644 --- a/lustre/utils/obd.c +++ b/lustre/utils/obd.c @@ -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) { diff --git a/lustre/utils/obdctl.h b/lustre/utils/obdctl.h index b81379504c630169e00e3d490bf06caf3162fabd..15067d8cc2e286dd2f5da5042fd285497d64e92a 100644 --- a/lustre/utils/obdctl.h +++ b/lustre/utils/obdctl.h @@ -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);