blktrace: perform cleanup after setup error
authorDmitry Monakhov <dmonakhov@openvz.org>
Sat, 27 Feb 2010 17:35:13 +0000 (20:35 +0300)
committerJens Axboe <jens.axboe@oracle.com>
Sun, 28 Feb 2010 18:47:19 +0000 (19:47 +0100)
Currently even if BLKTRACESETUP ioctl has failed user must call
BLKTRACETEARDOWN to be shure what all staff was cleaned, which
is contr-intuitive.
Let's setup ioctl make necessery cleanup by it self.

Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
kernel/trace/blktrace.c

index d9d6206e0b148f5c67e5ecda22a7c7992eec76d7..07f945a99430bfe58fd1dde80365a7e6e663147d 100644 (file)
@@ -540,9 +540,10 @@ int blk_trace_setup(struct request_queue *q, char *name, dev_t dev,
        if (ret)
                return ret;
 
-       if (copy_to_user(arg, &buts, sizeof(buts)))
+       if (copy_to_user(arg, &buts, sizeof(buts))) {
+               blk_trace_remove(q);
                return -EFAULT;
-
+       }
        return 0;
 }
 EXPORT_SYMBOL_GPL(blk_trace_setup);