aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/blktrace.c
diff options
context:
space:
mode:
authorLi Zefan <lizf@cn.fujitsu.com>2009-03-19 21:49:08 -0400
committerIngo Molnar <mingo@elte.hu>2009-03-21 11:16:54 -0400
commit15152e448b693fa41de40f1e40ffbe717a3aab88 (patch)
tree0fec87dd1850aa8e6e8be21bebb3ce0bd3bf148a /kernel/trace/blktrace.c
parentcbe28296eb1ac441b35cf45804d0ae808add7dd1 (diff)
blktrace: report EBUSY correctly
blk_trace_remove_queue() returns EINVAL if q->blk_trace == NULL, but blk_trace_setup_queue() doesn't return EBUSY if q->blk_trace != NULL. # echo 0 > sdaX/trace/enable # echo 0 > sdaX/trace/enable bash: echo: write error: Invalid argument # echo 1 > sdaX/trace/enable # echo 1 > sdaX/trace/enable (should return EBUSY) Signed-off-by: Li Zefan <lizf@cn.fujitsu.com> Acked-by: Arnaldo Carvalho de Melo <acme@redhat.com> Acked-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Jens Axboe <jens.axboe@oracle.com> Cc: Steven Rostedt <rostedt@goodmis.org> LKML-Reference: <49C2F614.2010101@cn.fujitsu.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/trace/blktrace.c')
-rw-r--r--kernel/trace/blktrace.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/kernel/trace/blktrace.c b/kernel/trace/blktrace.c
index 11e7c8d9d222..14986afdbc1c 100644
--- a/kernel/trace/blktrace.c
+++ b/kernel/trace/blktrace.c
@@ -1260,12 +1260,10 @@ static int blk_trace_remove_queue(struct request_queue *q)
1260static int blk_trace_setup_queue(struct request_queue *q, dev_t dev) 1260static int blk_trace_setup_queue(struct request_queue *q, dev_t dev)
1261{ 1261{
1262 struct blk_trace *old_bt, *bt = NULL; 1262 struct blk_trace *old_bt, *bt = NULL;
1263 int ret;
1264 1263
1265 ret = -ENOMEM;
1266 bt = kzalloc(sizeof(*bt), GFP_KERNEL); 1264 bt = kzalloc(sizeof(*bt), GFP_KERNEL);
1267 if (!bt) 1265 if (!bt)
1268 goto err; 1266 return -ENOMEM;
1269 1267
1270 bt->dev = dev; 1268 bt->dev = dev;
1271 bt->act_mask = (u16)-1; 1269 bt->act_mask = (u16)-1;
@@ -1276,11 +1274,10 @@ static int blk_trace_setup_queue(struct request_queue *q, dev_t dev)
1276 if (old_bt != NULL) { 1274 if (old_bt != NULL) {
1277 (void)xchg(&q->blk_trace, old_bt); 1275 (void)xchg(&q->blk_trace, old_bt);
1278 kfree(bt); 1276 kfree(bt);
1279 ret = -EBUSY; 1277 return -EBUSY;
1280 } 1278 }
1279
1281 return 0; 1280 return 0;
1282err:
1283 return ret;
1284} 1281}
1285 1282
1286/* 1283/*