From: Andy Isaacson <adi@hexapodia.org>
To: linux-kernel@vger.kernel.org,
Steven Rostedt <rostedt@goodmis.org>,
Frederic Weisbecker <fweisbec@gmail.com>,
Ingo Molnar <mingo@redhat.com>,
Jens Axboe <jens.axboe@oracle.com>,
Masami Hiramatsu <mhiramat@redhat.com>
Subject: [PATCH 2/2] blktrace: unlink blk directory on final trace close
Date: Thu, 15 Jul 2010 10:20:48 -0700 [thread overview]
Message-ID: <20100715172048.GC12953@hexapodia.org> (raw)
In-Reply-To: <20100715171937.GA12953@hexapodia.org>
blktrace fails to completely clean up after itself if BLKTRACESTOP is
called before the final trace file is closed:
% blktrace /dev/sdb &
% exec 6</sys/kernel/debug/block/sdb/trace0
% kill %1
% find /sys/kernel/debug/block/
/sys/kernel/debug/block/
/sys/kernel/debug/block/sdb
/sys/kernel/debug/block/sdb/trace0
% exec 6<&-
% find /sys/kernel/debug/block/
/sys/kernel/debug/block/
/sys/kernel/debug/block/sdb
The proper fix is to move cleanup from BLKTRACESTOP to the close
routine, but that's nontrivial, so here's a simple fix to remove
debug/block/<dev> when the last trace%d file is closed.
Cc: stable@kernel.org
Signed-off-by: Andy Isaacson <adi@hexapodia.org>
---
kernel/trace/blktrace.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 347fe8e..9b78930 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -383,8 +383,12 @@ static int blk_subbuf_start_callback(struct rchan_buf *buf, void *subbuf,
static int blk_remove_buf_file_callback(struct dentry *dentry)
{
+ struct dentry *parent = dentry->d_parent;
debugfs_remove(dentry);
+ if (simple_empty(parent))
+ debugfs_remove(parent);
+
return 0;
}
--
1.7.1
prev parent reply other threads:[~2010-07-15 17:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-15 17:19 [PATCH 0/2] blktrace: startup / shutdown race fixes Andy Isaacson
2010-07-15 17:20 ` [PATCH 1/2] blktrace: use cmpxchg Andy Isaacson
2010-07-15 17:20 ` Andy Isaacson [this message]
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=20100715172048.GC12953@hexapodia.org \
--to=adi@hexapodia.org \
--cc=fweisbec@gmail.com \
--cc=jens.axboe@oracle.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhiramat@redhat.com \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.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
all inboxes | Powered by JetHome®