[PATCH] bcache: lock in btree_flush_write() to avoid races

2018-01-23 Thread tang . junhui
From: Tang Junhui In btree_flush_write(), two places need to take a locker to avoid races: Firstly, we need take rcu read locker to protect the bucket_hash traverse, since hlist_for_each_entry_rcu() must be called under the protection of rcu read locker. Secondly, we

Re: [PATCH] blk-mq-debugfs: don't allow write on attributes with seq_operations set

2018-01-23 Thread Eryu Guan
On Wed, Jan 24, 2018 at 11:49:26AM +0800, Ming Lei wrote: > On Tue, Jan 23, 2018 at 02:32:06PM -0700, Jens Axboe wrote: > > On 1/23/18 10:20 AM, Eryu Guan wrote: > > > Attributes that only implement .seq_ops are read-only, any write to > > > them should be rejected. But currently kernel would

Re: [PATCH] blk-mq-debugfs: don't allow write on attributes with seq_operations set

2018-01-23 Thread Ming Lei
On Tue, Jan 23, 2018 at 02:32:06PM -0700, Jens Axboe wrote: > On 1/23/18 10:20 AM, Eryu Guan wrote: > > Attributes that only implement .seq_ops are read-only, any write to > > them should be rejected. But currently kernel would crash when > > writing to such debugfs entries, e.g. > > > > chmod +w

Re: [PATCH V3] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Ming Lei
On Tue, Jan 23, 2018 at 04:57:34PM +, Bart Van Assche wrote: > On Wed, 2018-01-24 at 00:37 +0800, Ming Lei wrote: > > On Tue, Jan 23, 2018 at 04:24:20PM +, Bart Van Assche wrote: > > > My opinion about this patch is as follows: > > > * Changing a blk_mq_delay_run_hw_queue() call followed

Re: [PATCH v2] bsg: use pr_debug instead of hand craftet macros

2018-01-23 Thread Joe Perches
On Tue, 2018-01-23 at 23:12 +, Bart Van Assche wrote: > On Tue, 2018-01-23 at 04:45 -0800, Joe Perches wrote: > > Perhaps the email subject could be improved to describe > > the new macro and as well, this macro, without a pr_fmt > > define somewhat above it loses the __func__ output too. > >

Re: [PATCH 1/5] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Ming Lei
On Tue, Jan 23, 2018 at 10:01:37PM +, Bart Van Assche wrote: > On Wed, 2018-01-24 at 00:59 +0800, Ming Lei wrote: > > How is that enough to fix the IO hang when driver returns STS_RESOURCE > > and the queue is idle? If you want to follow previous dm-rq's way of > > call

Re: [PATCH v5 1/2] Return bytes transferred for partial direct I/O

2018-01-23 Thread Andreas Dilger
On Jan 22, 2018, at 8:28 PM, Jens Axboe wrote: > > On 1/22/18 8:18 PM, Goldwyn Rodrigues wrote: >>> that their application was "already broken". I'd hate for a kernel >>> upgrade to break them. >>> >>> I do wish we could make the change, and maybe we can. But it probably >>>

Re: [PATCH v2] bsg: use pr_debug instead of hand craftet macros

2018-01-23 Thread Bart Van Assche
On Tue, 2018-01-23 at 04:45 -0800, Joe Perches wrote: > Perhaps the email subject could be improved to describe > the new macro and as well, this macro, without a pr_fmt > define somewhat above it loses the __func__ output too. Hmm ... I thought that the pr_debug() output can be configured to

Re: [PATCH 1/5] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Bart Van Assche
On Wed, 2018-01-24 at 00:59 +0800, Ming Lei wrote: > How is that enough to fix the IO hang when driver returns STS_RESOURCE > and the queue is idle? If you want to follow previous dm-rq's way of > call blk_mq_delay_run_hw_queue() in .queue_rq(), the same trick need > to be applied to other drivers

Re: [PATCH] blk-mq-debugfs: don't allow write on attributes with seq_operations set

2018-01-23 Thread Jens Axboe
On 1/23/18 10:20 AM, Eryu Guan wrote: > Attributes that only implement .seq_ops are read-only, any write to > them should be rejected. But currently kernel would crash when > writing to such debugfs entries, e.g. > > chmod +w /sys/kernel/debug/block//requeue_list > echo 0 >

Re: Hard LOCKUP on 4.15-rc9 + 'blkmq/for-next' branch

2018-01-23 Thread David Zarzycki
> On Jan 23, 2018, at 13:00, Jens Axboe wrote: > > On 1/23/18 10:54 AM, David Zarzycki wrote: >> Hi Jens, >> >> The bug still reproduces with this change. How confident are we that >> kernel objects are properly reference counted while they are >> throttled? > > I would be

Re: Hard LOCKUP on 4.15-rc9 + 'blkmq/for-next' branch

2018-01-23 Thread Jens Axboe
On 1/23/18 10:54 AM, David Zarzycki wrote: > Hi Jens, > > The bug still reproduces with this change. How confident are we that > kernel objects are properly reference counted while they are > throttled? I would be surprised if it made a change, thanks for checking. Since you're not pulling

Re: Hard LOCKUP on 4.15-rc9 + 'blkmq/for-next' branch

2018-01-23 Thread David Zarzycki
Hi Jens, The bug still reproduces with this change. How confident are we that kernel objects are properly reference counted while they are throttled? Dave > On Jan 23, 2018, at 10:34, Jens Axboe wrote: > > On 1/23/18 6:48 AM, David Zarzycki wrote: >> >> >>> On Jan 22,

[PATCH] blk-mq-debugfs: don't allow write on attributes with seq_operations set

2018-01-23 Thread Eryu Guan
Attributes that only implement .seq_ops are read-only, any write to them should be rejected. But currently kernel would crash when writing to such debugfs entries, e.g. chmod +w /sys/kernel/debug/block//requeue_list echo 0 > /sys/kernel/debug/block//requeue_list chmod -w

Re: [PATCH 1/5] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Ming Lei
On Tue, Jan 23, 2018 at 04:54:02PM +, Bart Van Assche wrote: > On Wed, 2018-01-24 at 00:49 +0800, Ming Lei wrote: > > On Tue, Jan 23, 2018 at 04:47:11PM +, Bart Van Assche wrote: > > > On Wed, 2018-01-24 at 00:41 +0800, Ming Lei wrote: > > > > Could you explain where to call call_rcu()?

Re: [PATCH V3] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Bart Van Assche
On Wed, 2018-01-24 at 00:37 +0800, Ming Lei wrote: > On Tue, Jan 23, 2018 at 04:24:20PM +, Bart Van Assche wrote: > > My opinion about this patch is as follows: > > * Changing a blk_mq_delay_run_hw_queue() call followed by return > > BLK_STS_DEV_RESOURCE into return BLK_STS_RESOURCE is wrong

Re: [PATCH 1/5] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Bart Van Assche
On Wed, 2018-01-24 at 00:49 +0800, Ming Lei wrote: > On Tue, Jan 23, 2018 at 04:47:11PM +, Bart Van Assche wrote: > > On Wed, 2018-01-24 at 00:41 +0800, Ming Lei wrote: > > > Could you explain where to call call_rcu()? call_rcu() can't be used in > > > IO path at all. > > > > Can you explain

Re: [PATCH 1/5] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Ming Lei
On Tue, Jan 23, 2018 at 04:47:11PM +, Bart Van Assche wrote: > On Wed, 2018-01-24 at 00:41 +0800, Ming Lei wrote: > > Could you explain where to call call_rcu()? call_rcu() can't be used in > > IO path at all. > > Can you explain what makes you think that call_rcu() can't be used in the >

Re: [PATCH 1/5] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Bart Van Assche
On Wed, 2018-01-24 at 00:41 +0800, Ming Lei wrote: > Could you explain where to call call_rcu()? call_rcu() can't be used in > IO path at all. Can you explain what makes you think that call_rcu() can't be used in the I/O path? As you know call_rcu() invokes a function asynchronously. From

Re: [PATCH] block: neutralize blk_insert_cloned_request IO stall regression (was: Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle)

2018-01-23 Thread Bart Van Assche
On Tue, 2018-01-23 at 10:22 +0100, Mike Snitzer wrote: > On Thu, Jan 18 2018 at 5:20pm -0500, > Bart Van Assche wrote: > > > On Thu, 2018-01-18 at 17:01 -0500, Mike Snitzer wrote: > > > And yet Laurence cannot reproduce any such lockups with your test... > > > > Hmm ...

Re: [PATCH 1/5] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Ming Lei
On Tue, Jan 23, 2018 at 08:37:26AM -0800, Bart Van Assche wrote: > On 01/23/18 08:26, Ming Lei wrote: > > On Tue, Jan 23, 2018 at 08:17:02AM -0800, Bart Van Assche wrote: > > > On 01/22/18 16:57, Ming Lei wrote: > > > > Even though RCU lock is held during dispatch, preemption or interrupt > > > >

Re: [PATCH V3] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Ming Lei
On Tue, Jan 23, 2018 at 04:24:20PM +, Bart Van Assche wrote: > On Wed, 2018-01-24 at 00:16 +0800, Ming Lei wrote: > > @@ -1280,10 +1282,18 @@ bool blk_mq_dispatch_rq_list(struct request_queue > > *q, struct list_head *list, > > * - Some but not all block drivers stop a queue

Re: [PATCH 1/5] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Bart Van Assche
On 01/23/18 08:26, Ming Lei wrote: On Tue, Jan 23, 2018 at 08:17:02AM -0800, Bart Van Assche wrote: On 01/22/18 16:57, Ming Lei wrote: Even though RCU lock is held during dispatch, preemption or interrupt can happen too, so it is simply wrong to depend on the timing to make sure

Re: [PATCH 1/5] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Ming Lei
On Tue, Jan 23, 2018 at 08:17:02AM -0800, Bart Van Assche wrote: > > > On 01/22/18 16:57, Ming Lei wrote: > > Even though RCU lock is held during dispatch, preemption or interrupt > > can happen too, so it is simply wrong to depend on the timing to make > > sure __blk_mq_run_hw_queue() can see

Re: [PATCH V3] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Bart Van Assche
On Wed, 2018-01-24 at 00:16 +0800, Ming Lei wrote: > @@ -1280,10 +1282,18 @@ bool blk_mq_dispatch_rq_list(struct request_queue *q, > struct list_head *list, >* - Some but not all block drivers stop a queue before >* returning BLK_STS_RESOURCE. Two exceptions are

Re: [PATCH V3] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Mike Snitzer
On Tue, Jan 23 2018 at 11:16am -0500, Ming Lei wrote: > This status is returned from driver to block layer if device related > resource is run out of, but driver can guarantee that IO dispatch will > be triggered in future when the resource is available. > > This patch

[PATCH V3] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Ming Lei
This status is returned from driver to block layer if device related resource is run out of, but driver can guarantee that IO dispatch will be triggered in future when the resource is available. This patch converts some drivers to use this return value. Meantime if driver returns BLK_STS_RESOURCE

Re: confusion about bio_split

2018-01-23 Thread Jens Axboe
On 1/23/18 12:00 AM, NeilBrown wrote: > On Mon, Jan 15 2018, Wang Sheng-Hui wrote: > >> Dear, >> >> Sorry to trouble you. >> >> I'm confused by the following code in bio.c/bio_split: >> - >> struct bio *bio_split(struct bio *bio, int sectors, >> ... >> if

Re: Hard LOCKUP on 4.15-rc9 + 'blkmq/for-next' branch

2018-01-23 Thread Jens Axboe
On 1/23/18 6:48 AM, David Zarzycki wrote: > > >> On Jan 22, 2018, at 20:20, Jens Axboe wrote: >> >> All of these are off the blk-wbt completion path. I suggested earlier to >> try and disable CONFIG_BLK_WBT to see if it goes away, or at least to >> see if the pattern changes. >

Re: [PATCH V2] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Laurence Oberman
On Tue, 2018-01-23 at 09:44 -0500, Mike Snitzer wrote: > On Tue, Jan 23 2018 at  9:27am -0500, > Ming Lei wrote: > > > Hello Martin, > > > > On Tue, Jan 23, 2018 at 08:30:41AM -0500, Martin K. Petersen wrote: > > > > > > Ming, > > > > > > > + * Block layer and block

Re: [PATCH V2] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Mike Snitzer
On Tue, Jan 23 2018 at 9:27am -0500, Ming Lei wrote: > Hello Martin, > > On Tue, Jan 23, 2018 at 08:30:41AM -0500, Martin K. Petersen wrote: > > > > Ming, > > > > > + * Block layer and block driver specific status, which is ususally > > > returnd > >

Re: [PATCH V2] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Ming Lei
Hello Martin, On Tue, Jan 23, 2018 at 08:30:41AM -0500, Martin K. Petersen wrote: > > Ming, > > > + * Block layer and block driver specific status, which is ususally returnd > ^^^ > > + * from driver to block layer in IO

Re: [PATCH V2] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Ming Lei
On Tue, Jan 23, 2018 at 08:30:41AM -0500, Martin K. Petersen wrote: > > Ming, > > > + * Block layer and block driver specific status, which is ususally returnd > ^^^ > > + * from driver to block layer in IO path. > >

Re: Hard LOCKUP on 4.15-rc9 + 'blkmq/for-next' branch

2018-01-23 Thread David Zarzycki
> On Jan 22, 2018, at 20:20, Jens Axboe wrote: > > All of these are off the blk-wbt completion path. I suggested earlier to > try and disable CONFIG_BLK_WBT to see if it goes away, or at least to > see if the pattern changes. Hi Jens, Bingo! Disabling CONFIG_BLK_WBT makes

Re: [PATCH V2] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Martin K. Petersen
Ming, > + * Block layer and block driver specific status, which is ususally returnd ^^^ > + * from driver to block layer in IO path. Given that the comment blurb is long and the flag not defined until later, it is not

[PATCH] block/sed-opal: Fix trailing semicolon

2018-01-23 Thread Luis de Bethencourt
The trailing semicolon is an empty statement that does no operation. Removing it since it doesn't do anything. Signed-off-by: Luis de Bethencourt --- Hi, Similar to the other drivers/clocksource/ patch [0]. After fixing the same thing in drivers/staging/rtl8723bs/, Joe

Re: block: neutralize blk_insert_cloned_request IO stall regression (was: Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle)

2018-01-23 Thread Mike Snitzer
On Tue, Jan 23 2018 at 7:17am -0500, Ming Lei wrote: > On Tue, Jan 23, 2018 at 8:15 PM, Mike Snitzer wrote: > > On Tue, Jan 23 2018 at 5:53am -0500, > > Ming Lei wrote: > > > >> Hi Mike, > >> > >> On Tue, Jan 23, 2018 at

Re: block: neutralize blk_insert_cloned_request IO stall regression (was: Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle)

2018-01-23 Thread Ming Lei
On Tue, Jan 23, 2018 at 8:15 PM, Mike Snitzer wrote: > On Tue, Jan 23 2018 at 5:53am -0500, > Ming Lei wrote: > >> Hi Mike, >> >> On Tue, Jan 23, 2018 at 10:22:04AM +0100, Mike Snitzer wrote: >> > On Thu, Jan 18 2018 at 5:20pm -0500, >> > Bart Van

Re: block: neutralize blk_insert_cloned_request IO stall regression (was: Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle)

2018-01-23 Thread Mike Snitzer
On Tue, Jan 23 2018 at 5:53am -0500, Ming Lei wrote: > Hi Mike, > > On Tue, Jan 23, 2018 at 10:22:04AM +0100, Mike Snitzer wrote: > > On Thu, Jan 18 2018 at 5:20pm -0500, > > Bart Van Assche wrote: > > > > > On Thu, 2018-01-18 at 17:01 -0500,

[PATCH v2] bsg: use pr_debug instead of hand craftet macros

2018-01-23 Thread Johannes Thumshirn
Use pr_debug instead of hand craftet macros. This way it is not needed to re-compile the kernel to enable bsg debug outputs and it's possible to selectively enable specific prints. Signed-off-by: Johannes Thumshirn Cc: Joe Perches Cc: Bart Van Assche

[PATCH V2] blk-mq: introduce BLK_STS_DEV_RESOURCE

2018-01-23 Thread Ming Lei
This status is returned from driver to block layer if device related resource is run out of, but driver can guarantee that IO dispatch will be triggered in future when the resource is available. This patch converts some drivers to use this return value. Meantime if driver returns BLK_STS_RESOURCE

Re: [PATCH] block: neutralize blk_insert_cloned_request IO stall regression (was: Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle)

2018-01-23 Thread Ming Lei
Hi Mike, On Tue, Jan 23, 2018 at 10:22:04AM +0100, Mike Snitzer wrote: > On Thu, Jan 18 2018 at 5:20pm -0500, > Bart Van Assche wrote: > > > On Thu, 2018-01-18 at 17:01 -0500, Mike Snitzer wrote: > > > And yet Laurence cannot reproduce any such lockups with your test...

[PATCH] block: neutralize blk_insert_cloned_request IO stall regression (was: Re: [RFC PATCH] blk-mq: fixup RESTART when queue becomes idle)

2018-01-23 Thread Mike Snitzer
On Thu, Jan 18 2018 at 5:20pm -0500, Bart Van Assche wrote: > On Thu, 2018-01-18 at 17:01 -0500, Mike Snitzer wrote: > > And yet Laurence cannot reproduce any such lockups with your test... > > Hmm ... maybe I misunderstood Laurence but I don't think that Laurence has >

Re: [PATCH] Documentation/ABI: clean up sysfs-class-pktcdvd

2018-01-23 Thread Julia Lawall
On Tue, 23 Jan 2018, Aishwarya Pant wrote: > Clean up the sysfs documentation such that it is in the same format as > described in Documentation/ABI/README. Mainly, the patch moves the > attribute names to the 'What:' field. This might be useful for scripting > and tracking changes in the ABI.

[PATCH] Documentation/ABI: clean up sysfs-class-pktcdvd

2018-01-23 Thread Aishwarya Pant
Clean up the sysfs documentation such that it is in the same format as described in Documentation/ABI/README. Mainly, the patch moves the attribute names to the 'What:' field. This might be useful for scripting and tracking changes in the ABI. Signed-off-by: Aishwarya Pant