All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Small fixes for LightNVM core
@ 2017-02-15 15:25 Matias Bjørling
  2017-02-15 15:25 ` [PATCH 1/2] lightnvm: fix off-by-one error on target initialization Matias Bjørling
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Matias Bjørling @ 2017-02-15 15:25 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel, Matias Bjørling

Hi Jens,

Would these two small patches be able to make it for the 4.11 window? If
not it is totally fine, and I'll include them in the 4.12 drop.

Thank you,
Matias

Matias Bjørling (2):
  lightnvm: fix off-by-one error on target initialization
  lightnvm: set default lun range when no luns are specified

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

-- 
2.9.3

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/2] lightnvm: fix off-by-one error on target initialization
  2017-02-15 15:25 [PATCH 0/2] Small fixes for LightNVM core Matias Bjørling
@ 2017-02-15 15:25 ` Matias Bjørling
  2017-02-15 15:25 ` [PATCH 2/2] lightnvm: set default lun range when no luns are specified Matias Bjørling
  2017-02-15 15:27   ` Jens Axboe
  2 siblings, 0 replies; 6+ messages in thread
From: Matias Bjørling @ 2017-02-15 15:25 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel, Matias Bjørling

If one specifies the end lun id to be the absolute number of luns,
without taking zero indexing into account, the lightnvm core will pass
the off-by-one end lun id to target creation, which then panics during
nvm_ioctl_dev_create.

Signed-off-by: Matias Bjørling <matias@cnexlabs.com>
---
 drivers/lightnvm/core.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 9bfe035..6ce76c0 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -1102,9 +1102,9 @@ static int __nvm_configure_create(struct nvm_ioctl_create *create)
 	}
 	s = &create->conf.s;
 
-	if (s->lun_begin > s->lun_end || s->lun_end > dev->geo.nr_luns) {
+	if (s->lun_begin > s->lun_end || s->lun_end >= dev->geo.nr_luns) {
 		pr_err("nvm: lun out of bound (%u:%u > %u)\n",
-			s->lun_begin, s->lun_end, dev->geo.nr_luns);
+			s->lun_begin, s->lun_end, dev->geo.nr_luns - 1);
 		return -EINVAL;
 	}
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/2] lightnvm: set default lun range when no luns are specified
  2017-02-15 15:25 [PATCH 0/2] Small fixes for LightNVM core Matias Bjørling
  2017-02-15 15:25 ` [PATCH 1/2] lightnvm: fix off-by-one error on target initialization Matias Bjørling
@ 2017-02-15 15:25 ` Matias Bjørling
  2017-02-15 15:27   ` Jens Axboe
  2 siblings, 0 replies; 6+ messages in thread
From: Matias Bjørling @ 2017-02-15 15:25 UTC (permalink / raw)
  To: axboe; +Cc: linux-block, linux-kernel, Matias Bjørling

The create target ioctl takes a lun begin and lun end parameter, which
defines the range of luns to initialize a target with. If the user does
not set the parameters, it default to only using lun 0. Instead,
defaults to use all luns in the OCSSD, as it is the usual behaviour
users want.

Signed-off-by: Matias Bjørling <matias@cnexlabs.com>
---
 drivers/lightnvm/core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/lightnvm/core.c b/drivers/lightnvm/core.c
index 6ce76c0..5262ba6 100644
--- a/drivers/lightnvm/core.c
+++ b/drivers/lightnvm/core.c
@@ -1102,6 +1102,11 @@ static int __nvm_configure_create(struct nvm_ioctl_create *create)
 	}
 	s = &create->conf.s;
 
+	if (s->lun_begin == -1 && s->lun_end == -1) {
+		s->lun_begin = 0;
+		s->lun_end = dev->geo.nr_luns - 1;
+	}
+
 	if (s->lun_begin > s->lun_end || s->lun_end >= dev->geo.nr_luns) {
 		pr_err("nvm: lun out of bound (%u:%u > %u)\n",
 			s->lun_begin, s->lun_end, dev->geo.nr_luns - 1);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] Small fixes for LightNVM core
  2017-02-15 15:25 [PATCH 0/2] Small fixes for LightNVM core Matias Bjørling
@ 2017-02-15 15:27   ` Jens Axboe
  2017-02-15 15:25 ` [PATCH 2/2] lightnvm: set default lun range when no luns are specified Matias Bjørling
  2017-02-15 15:27   ` Jens Axboe
  2 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2017-02-15 15:27 UTC (permalink / raw)
  To: Matias Bjørling; +Cc: linux-block, linux-kernel

On 02/15/2017 08:25 AM, Matias Bjørling wrote:
> Hi Jens,
> 
> Would these two small patches be able to make it for the 4.11 window? If
> not it is totally fine, and I'll include them in the 4.12 drop.

There's still time, queued up for 4.11.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] Small fixes for LightNVM core
@ 2017-02-15 15:27   ` Jens Axboe
  0 siblings, 0 replies; 6+ messages in thread
From: Jens Axboe @ 2017-02-15 15:27 UTC (permalink / raw)
  To: Matias Bjørling; +Cc: linux-block, linux-kernel

On 02/15/2017 08:25 AM, Matias Bjørling wrote:
> Hi Jens,
> 
> Would these two small patches be able to make it for the 4.11 window? If
> not it is totally fine, and I'll include them in the 4.12 drop.

There's still time, queued up for 4.11.

-- 
Jens Axboe

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH 0/2] Small fixes for LightNVM core
  2017-02-15 15:27   ` Jens Axboe
  (?)
@ 2017-02-15 15:28   ` Matias Bjørling
  -1 siblings, 0 replies; 6+ messages in thread
From: Matias Bjørling @ 2017-02-15 15:28 UTC (permalink / raw)
  To: Jens Axboe, Matias Bjørling; +Cc: linux-block, linux-kernel

On 02/15/2017 04:27 PM, Jens Axboe wrote:
> On 02/15/2017 08:25 AM, Matias Bjørling wrote:
>> Hi Jens,
>>
>> Would these two small patches be able to make it for the 4.11 window? If
>> not it is totally fine, and I'll include them in the 4.12 drop.
> 
> There's still time, queued up for 4.11.
> 

Terrific! Thanks :)

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-02-15 15:28 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-15 15:25 [PATCH 0/2] Small fixes for LightNVM core Matias Bjørling
2017-02-15 15:25 ` [PATCH 1/2] lightnvm: fix off-by-one error on target initialization Matias Bjørling
2017-02-15 15:25 ` [PATCH 2/2] lightnvm: set default lun range when no luns are specified Matias Bjørling
2017-02-15 15:27 ` [PATCH 0/2] Small fixes for LightNVM core Jens Axboe
2017-02-15 15:27   ` Jens Axboe
2017-02-15 15:28   ` Matias Bjørling

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.