From: Zorro Lang <zlang@redhat.com>
To: fstests@vger.kernel.org
Subject: [PATCH] fsstress: cleanup flist with test directory together
Date: Wed, 17 May 2017 23:48:47 +0800 [thread overview]
Message-ID: <1495036127-11648-1-git-send-email-zlang@redhat.com> (raw)
The "-c" option of fsstress will clean up the test directory after
each run. But it only does "rm -rf $dir". If run fsstress likes:
fsstress -d $test_dir -n 1000 -p 10 -l 0 -c
fsstress will remove all test directories at the end of each run,
but the flist still save those *deleted* entries. It'll cause
more and more useless ENOENT failures. So we need to release all
entries in flist too.
Signed-off-by: Zorro Lang <zlang@redhat.com>
---
ltp/fsstress.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index 6d8f117..e9fd276 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -280,6 +280,7 @@ int attr_list_path(pathname_t *, char *, const int, int, attrlist_cursor_t *);
int attr_remove_path(pathname_t *, const char *, int);
int attr_set_path(pathname_t *, const char *, const char *, const int, int);
void check_cwd(void);
+void cleanup_flist(void);
int creat_path(pathname_t *, mode_t);
void dcache_enter(int, int);
void dcache_init(void);
@@ -794,6 +795,25 @@ check_cwd(void)
#endif
}
+/*
+ * go thru flist and release all entries
+ *
+ * NOTE: this function shouldn't be called until the end of a process
+ */
+void
+cleanup_flist(void)
+{
+ flist_t *flp;
+ int i;
+
+ for (i = 0, flp = flist; i < FT_nft; i++, flp++) {
+ flp->nslots = 0;
+ flp->nfiles = 0;
+ free(flp->fents);
+ flp->fents = NULL;
+ }
+}
+
int
creat_path(pathname_t *name, mode_t mode)
{
@@ -945,6 +965,7 @@ errout:
if (cleanup) {
sprintf(cmd, "rm -rf %s", buf);
system(cmd);
+ cleanup_flist();
}
}
--
2.7.4
reply other threads:[~2017-05-17 15:48 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1495036127-11648-1-git-send-email-zlang@redhat.com \
--to=zlang@redhat.com \
--cc=fstests@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox