diff options
author | Rakesh Pandit <rakesh@tuxera.com> | 2017-06-27 13:55:33 +0200 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2017-06-27 16:22:09 +0200 |
commit | 12e9a6d62236dacb87a6b2dd84dd9c29bb5be1de (patch) | |
tree | c5bd791aa194772ec7eca4c1842b0d81cdeed2d3 /drivers/lightnvm | |
parent | lightnvm: pblk: fail gracefully on irrec. error (diff) | |
download | linux-12e9a6d62236dacb87a6b2dd84dd9c29bb5be1de.tar.xz linux-12e9a6d62236dacb87a6b2dd84dd9c29bb5be1de.zip |
lightnvm: if LUNs are already allocated fix return
While creating new device with NVM_DEV_CREATE if LUNs are already
allocated ioctl would return -ENOMEM which is wrong. This patch
propagates -EBUSY from nvm_reserve_luns which is correct response.
Fixes: ade69e243 ("lightnvm: merge gennvm with core")
Reviewed-by: Frans Klaver <fransklaver@gmail.com>
Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Diffstat (limited to 'drivers/lightnvm')
-rw-r--r-- | drivers/lightnvm/core.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c index b8f82f5c6c0d..ddae430b6eae 100644 --- a/drivers/lightnvm/core.c +++ b/drivers/lightnvm/core.c @@ -252,8 +252,9 @@ static int nvm_create_tgt(struct nvm_dev *dev, struct nvm_ioctl_create *create) } mutex_unlock(&dev->mlock); - if (nvm_reserve_luns(dev, s->lun_begin, s->lun_end)) - return -ENOMEM; + ret = nvm_reserve_luns(dev, s->lun_begin, s->lun_end); + if (ret) + return ret; t = kmalloc(sizeof(struct nvm_target), GFP_KERNEL); if (!t) { |