Skip to contentSkip to conversation

Remove debugfs entries on bad path

PATCH In review Stefan Raspl 2 participants 4 messages May 18, 2009 – May 19, 2009

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

PATCH 1/1 Remove debugfs entries on bad path

debugfs directory entries for devices are not removed on bad path. If so, 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

A better title:
[Patch] blktrace: remove debugfs entries on bad path

Quoted 1 line · Stefan Raspl

debugfs directory entries for devices are not removed on bad path.

Can you be more elaborate on how to reproduce this issue?

Quoted 20 lines

If so, 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);
#2 lore raw

Re: [Patch] blktrace: remove debugfs entries on bad path

Quoted 7 lines · Li Zefan

A better title:
[Patch] blktrace: remove debugfs entries on bad path

Quoted 1 line · Stefan Raspl

debugfs directory entries for devices are not removed on bad path.

Can you be more elaborate on how to reproduce this issue?

It can happen for most bad pathes within do_blk_trace_setup(). One way to trigger is to set the Vmalloc space via the respective kernel parameter to a value that is so small that it will not suffice for the 2MB per device and cpu that is required. For instance, set vmallocM and start blktrace on a system with 2 cpus on 7 devices. Depending on how much Vmalloc space is still free, the final 2 or 3 devices will fail with a message like this:

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

Best regards,
Stefan Raspl

Acked-by
#3 lore raw

Re: [Patch] blktrace: remove debugfs entries on bad path

Quoted 9 lines · Stefan Raspl
Quoted 6 lines · Li Zefan

A better title:
[Patch] blktrace: remove debugfs entries on bad path

Quoted 1 line · Stefan Raspl

debugfs directory entries for devices are not removed on bad path.

Can you be more elaborate on how to reproduce this issue?

It can happen for most bad pathes within do_blk_trace_setup(). One

Now I see what you meant by "bad path". :)

I'd say "some failure pathes", but not "most".

Quoted 9 lines

way to trigger is to set the Vmalloc space via the respective kernel parameter to a value that is so small that it will not suffice for the 2MB per device and cpu that is required. For instance, set vmalloc=10M and start blktrace on a system with 2 cpus on 7 devices. Depending on how much Vmalloc space is still free, the final 2 or 3 devices will fail with a message like this:

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

Yes, this can happen under extreme memory stress.

Thanks for the fix:

Could you resend the patch to Ingo, with a better title and a better changelog (but IMHO we don't need to explain how to set up a memory stress to trigger this issue) and my ack tag? Now blktrace patches go to Ingo.