Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Rakesh Pandit and committed by
Jens Axboe
12e9a6d6 588726d3

+3 -2
+3 -2
drivers/lightnvm/core.c
··· 252 252 } 253 253 mutex_unlock(&dev->mlock); 254 254 255 - if (nvm_reserve_luns(dev, s->lun_begin, s->lun_end)) 256 - return -ENOMEM; 255 + ret = nvm_reserve_luns(dev, s->lun_begin, s->lun_end); 256 + if (ret) 257 + return ret; 257 258 258 259 t = kmalloc(sizeof(struct nvm_target), GFP_KERNEL); 259 260 if (!t) {