summaryrefslogtreecommitdiffstats
path: root/drivers/block
diff options
context:
space:
mode:
authorJens Axboe <axboe@fb.com>2016-11-23 03:09:45 +0100
committerJens Axboe <axboe@fb.com>2016-11-23 03:09:45 +0100
commitfeffa5cc7b47f38210d4997ceb3fe30881d6c337 (patch)
treed8c5028be43032e8dc15ff75ec72e0cd36576cdf /drivers/block
parentnbd: move multi-connection bit to unused value (diff)
downloadlinux-feffa5cc7b47f38210d4997ceb3fe30881d6c337.tar.xz
linux-feffa5cc7b47f38210d4997ceb3fe30881d6c337.zip
nbd: fix setting of 'error' in NBD_DO_IT ioctl
Multiple paths don't set it properly, ensure that we do. Fixes: 9561a7ade0c2 ("nbd: add multi-connection support") Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers/block')
-rw-r--r--drivers/block/nbd.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c
index e683e2241cbd..dc722a7adf58 100644
--- a/drivers/block/nbd.c
+++ b/drivers/block/nbd.c
@@ -745,7 +745,7 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
case NBD_DO_IT: {
struct recv_thread_args *args;
int num_connections = nbd->num_connections;
- int error, i;
+ int error = 0, i;
if (nbd->task_recv)
return -EBUSY;
@@ -754,14 +754,17 @@ static int __nbd_ioctl(struct block_device *bdev, struct nbd_device *nbd,
if (num_connections > 1 &&
!(nbd->flags & NBD_FLAG_CAN_MULTI_CONN)) {
dev_err(disk_to_dev(nbd->disk), "server does not support multiple connections per device.\n");
+ error = -EINVAL;
goto out_err;
}
set_bit(NBD_RUNNING, &nbd->runtime_flags);
blk_mq_update_nr_hw_queues(&nbd->tag_set, nbd->num_connections);
args = kcalloc(num_connections, sizeof(*args), GFP_KERNEL);
- if (!args)
+ if (!args) {
+ error = -ENOMEM;
goto out_err;
+ }
nbd->task_recv = current;
mutex_unlock(&nbd->config_lock);