[PATCH] pktcdvd.c: Fix wrong return code when alloc_disk() fails.

2018-08-14 Thread Jiecheng Wu
Function pkt_setup_dev() defined in drivers/block/pktcdvd.c calls alloc_disk(). 
However, it forgets to set the error return code when alloc_disk() fails. 
Instead, when alloc_disk() fails, it simply jumps to label 'out_mem' leaving 
the variable ret unchanged.
---
 drivers/block/pktcdvd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/block/pktcdvd.c b/drivers/block/pktcdvd.c
index b3f83cd..f63fa1f 100644
--- a/drivers/block/pktcdvd.c
+++ b/drivers/block/pktcdvd.c
@@ -2716,8 +2716,10 @@ static int pkt_setup_dev(dev_t dev, dev_t* pkt_dev)
pd->write_congestion_off = write_congestion_off;
 
disk = alloc_disk(1);
-   if (!disk)
+   if (!disk) {
+   ret = -ENOMEM;
goto out_mem;
+   }
pd->disk = disk;
disk->major = pktdev_major;
disk->first_minor = idx;
-- 
2.6.4



Re: [PATCH] blk-wbt: fix IO hang in wbt_wait()

2018-08-14 Thread Jens Axboe
On 8/14/18 9:57 AM, Ming Lei wrote:
> On wbt invariant is that if one IO is tracked via WBT_TRACKED, rqw->inflight
> should be updated for tracking this IO.
> 
> But commit c1c80384c8f ("block: remove external dependency on wbt_flags")
> forgets to remove the early handling of !rwb_enabled(rwb) inside wbt_wait(),
> then the inflight counter may not be increased in wbt_wait(), but decreased
> in wbt_done() for this kind of IO, so this counter may become negative, then
> wbt_wait() may wait forever.
> 
> This patch fixes the report in the following link:
> 
>   https://marc.info/?l=linux-block=153221542021033=2

Looks good to me, thanks for fixing this. Applied.

-- 
Jens Axboe



[PATCH] blk-wbt: fix IO hang in wbt_wait()

2018-08-14 Thread Ming Lei
On wbt invariant is that if one IO is tracked via WBT_TRACKED, rqw->inflight
should be updated for tracking this IO.

But commit c1c80384c8f ("block: remove external dependency on wbt_flags")
forgets to remove the early handling of !rwb_enabled(rwb) inside wbt_wait(),
then the inflight counter may not be increased in wbt_wait(), but decreased
in wbt_done() for this kind of IO, so this counter may become negative, then
wbt_wait() may wait forever.

This patch fixes the report in the following link:

https://marc.info/?l=linux-block=153221542021033=2

Fixes: c1c80384c8f ("block: remove external dependency on wbt_flags")
Cc: Josef Bacik 
Reported-by: Ming Lei 
Signed-off-by: Ming Lei 
---
 block/blk-wbt.c | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/block/blk-wbt.c b/block/blk-wbt.c
index 1d94a20374fc..bb93c7c2b182 100644
--- a/block/blk-wbt.c
+++ b/block/blk-wbt.c
@@ -576,12 +576,8 @@ static void wbt_wait(struct rq_qos *rqos, struct bio *bio, 
spinlock_t *lock)
struct rq_wb *rwb = RQWB(rqos);
enum wbt_flags flags;
 
-   if (!rwb_enabled(rwb))
-   return;
-
flags = bio_to_wbt_flags(rwb, bio);
-
-   if (!wbt_should_throttle(rwb, bio)) {
+   if (!(flags & WBT_TRACKED)) {
if (flags & WBT_READ)
wb_timestamp(rwb, >last_issue);
return;
-- 
2.9.5



Re: [PATCH 3/6] nvme: register ns_id attributes as default sysfs groups

2018-08-14 Thread Hannes Reinecke
On 08/13/2018 09:51 PM, Bart Van Assche wrote:
> On Mon, 2018-07-30 at 09:12 +0200, Hannes Reinecke wrote:
>> @@ -3061,11 +3066,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, 
>> unsigned nsid)
>>  
>>  nvme_get_ctrl(ctrl);
>>  
>> -device_add_disk(ctrl->device, ns->disk, NULL);
>> -if (sysfs_create_group(_to_dev(ns->disk)->kobj,
>> -_ns_id_attr_group))
>> -pr_warn("%s: failed to create sysfs group for identification\n",
>> -ns->disk->disk_name);
>> +device_add_disk(ctrl->device, ns->disk, nvme_ns_id_attr_groups);
>>  if (ns->ndev && nvme_nvm_register_sysfs(ns))
>>  pr_warn("%s: failed to register lightnvm sysfs group for 
>> identification\n",
>>  ns->disk->disk_name);
> 
> Hello Hannes,
> 
> Have you noticed that nvme_nvm_register_sysfs() also registers sysfs 
> attributes
> and hence that the attributes registered by that function should be merged 
> into
> the nvme_ns_id_attr_groups array?
> 
Actually, no :-)
I'll be looking into it and reposting the series.

Cheers,

Hannes
-- 
Dr. Hannes ReineckeTeamlead Storage & Networking
h...@suse.de   +49 911 74053 688
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: F. Imendörffer, J. Smithard, J. Guild, D. Upmanyu, G. Norton
HRB 21284 (AG Nürnberg)