Skip to contentSkip to conversation

blktrace: remove debugfs entries on bad path

PATCH In review Stefan Raspl 1 participant 2 messages May 19, 2009

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 blktrace: remove debugfs entries on bad path

debugfs directory entries for devices are not removed on some of the failure pathes in do_blk_trace_setup().
One way to reproduce is to start blktrace on multiple devices with insufficient Vmalloc space: Devices will fail with a message like this:

BLKTRACESETUP(2) /dev/sdu failed: 5/Input/output error

If so, the respective entries in debugfs
(e.g. /sys/kernel/debug/block/sdu) will remain and subsequent attempts to start blktrace on the respective devices will not succeed due to existing directories.

---
 kernel/trace/blktrace.c |    1 +
 1 file changed, 1 insertion(+)
kernel/trace/blktrace.c +1 -0
@@ -262,6 +262,7 @@ static void blk_trace_free(struct blk_tr
 {
 	debugfs_remove(bt->msg_file);
 	debugfs_remove(bt->dropped_file);
+	debugfs_remove(bt->dir);
 	relay_close(bt->rchan);
 	free_percpu(bt->sequence);
 	free_percpu(bt->msg_data);
#1 lore raw
Commit-ID:  fd51d251e4cdb21f68e9dbc4336514d64a105a79
Gitweb:     http://git.kernel.org/tip/fd51d251e4cdb21f68e9dbc4336514d64a105a79
Author:     Stefan Raspl <[email protected]>
AuthorDate: Tue, 19 May 2009 09:59:08 +0200
Committer:  Ingo Molnar <[email protected]>
CommitDate: Tue, 19 May 2009 10:29:21 +0200

blktrace: remove debugfs entries on bad path

debugfs directory entries for devices are not removed on some of the failure pathes in do_blk_trace_setup().
One way to reproduce is to start blktrace on multiple devices with insufficient Vmalloc space: Devices will fail with a message like this:

BLKTRACESETUP(2) /dev/sdu failed: 5/Input/output error

If so, the respective entries in debugfs
(e.g. /sys/kernel/debug/block/sdu) will remain and subsequent attempts to start blktrace on the respective devices will not succeed due to existing directories.

[ Impact: fix /debug/tracing file cleanup corner case ]

LKML-Reference: <[email protected]>

---
 kernel/trace/blktrace.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
kernel/trace/blktrace.c +1 -0
index 05b4747..e3abf55 100644
@@ -262,6 +262,7 @@ static void blk_trace_free(struct blk_trace *bt)
 {
 	debugfs_remove(bt->msg_file);
 	debugfs_remove(bt->dropped_file);
+	debugfs_remove(bt->dir);
 	relay_close(bt->rchan);
 	free_percpu(bt->sequence);
 	free_percpu(bt->msg_data);