Skip to content

Commit

Permalink
lightnvm: if LUNs are already allocated fix return
Browse files Browse the repository at this point in the history
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: ade69e2 ("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>
  • Loading branch information
Rakesh Pandit authored and Jens Axboe committed Jun 27, 2017
1 parent 588726d commit 12e9a6d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/lightnvm/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 12e9a6d

Please sign in to comment.