mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rakesh Pandit <rakesh@tuxera.com>
To: "Jens Axboe" <axboe@fb.com>, "Matias Bjørling" <m@bjorling.me>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	"Matias Bjørling" <matias@cnexlabs.com>,
	"Frans Klaver" <fransklaver@gmail.com>,
	"Javier González" <jg@lightnvm.io>
Subject: [PATCH V3] lightnvm: if LUNs are already allocated fix return
Date: Tue, 27 Jun 2017 14:55:33 +0300	[thread overview]
Message-ID: <20170627115531.GA53387@dhcp-216.srv.tuxera.com> (raw)

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")
Signed-off-by: Rakesh Pandit <rakesh@tuxera.com>
---

V3: Propagate return value from nvm_reserve_luns instead of hard-coding (Frans)
V2: return error code directly instead of using ret variable (Frans)

 drivers/lightnvm/core.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index b8f82f5..ddae430 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) {
-- 
2.5.5

             reply	other threads:[~2017-06-27 11:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-27 11:55 Rakesh Pandit [this message]
2017-06-27 11:57 ` Frans Klaver
2017-06-27 14:22 ` Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170627115531.GA53387@dhcp-216.srv.tuxera.com \
    --to=rakesh@tuxera.com \
    --cc=axboe@fb.com \
    --cc=fransklaver@gmail.com \
    --cc=jg@lightnvm.io \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m@bjorling.me \
    --cc=matias@cnexlabs.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®