From: Li Zefan Date: Fri, 20 Mar 2009 01:48:47 +0000 (+0800) Subject: blktrace: don't increase blk_probes_ref if failed to setup blk trace X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=cbe28296eb1ac441b35cf45804d0ae808add7dd1;p=GitHub%2Fmt8127%2Fandroid_kernel_alcatel_ttab.git blktrace: don't increase blk_probes_ref if failed to setup blk trace do_blk_trace_setup() may return EBUSY, but the current code doesn't decrease blk_probes_ref in this case. Signed-off-by: Li Zefan Acked-by: Frederic Weisbecker Acked-by: Arnaldo Carvalho de Melo Cc: Jens Axboe Cc: Steven Rostedt LKML-Reference: <49C2F5FF.80002@cn.fujitsu.com> Signed-off-by: Ingo Molnar --- diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c index 223b92e77b3f..11e7c8d9d222 100644 --- a/kernel/trace/blktrace.c +++ b/kernel/trace/blktrace.c @@ -468,9 +468,6 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, bt->pid = buts->pid; bt->trace_state = Blktrace_setup; - if (atomic_add_return(1, &blk_probes_ref) == 1) - blk_register_tracepoints(); - ret = -EBUSY; old_bt = xchg(&q->blk_trace, bt); if (old_bt) { @@ -478,6 +475,9 @@ int do_blk_trace_setup(struct request_queue *q, char *name, dev_t dev, goto err; } + if (atomic_add_return(1, &blk_probes_ref) == 1) + blk_register_tracepoints(); + return 0; err: if (bt) {