Re: unify and streamline the blk-mq make_request implementations V3

2017-03-22 Thread Jens Axboe
On 03/22/2017 01:01 PM, Christoph Hellwig wrote: > A bunch of cleanups to get us a nice I/O submission path. > > Changes since V2: > - really address the comments from Bart > - address another comment from Bart > > Changes since V1: > - rebase on top of the recent blk_mq_try_issue_directly

Re: [PATCH 0/10 v5] block: Fix block device shutdown related races

2017-03-22 Thread Jens Axboe
On 03/22/2017 06:36 PM, Jan Kara wrote: > Hello, > > this is a series with the remaining patches (on top of 4.11-rc2) to > fix several different races and issues I've found when testing device > shutdown and reuse. The first patch fixes possible (theoretical) > problems when opening of a block

[PATCH 0/10 v5] block: Fix block device shutdown related races

2017-03-22 Thread Jan Kara
Hello, this is a series with the remaining patches (on top of 4.11-rc2) to fix several different races and issues I've found when testing device shutdown and reuse. The first patch fixes possible (theoretical) problems when opening of a block device races with shutdown of a gendisk structure.

[PATCH 08/10] block: Fix oops in locked_inode_to_wb_and_lock_list()

2017-03-22 Thread Jan Kara
When block device is closed, we call inode_detach_wb() in __blkdev_put() which sets inode->i_wb to NULL. That is contrary to expectations that inode->i_wb stays valid once set during the whole inode's lifetime and leads to oops in wb_get() in locked_inode_to_wb_and_lock_list() because

[PATCH 03/10] bdi: Make wb->bdi a proper reference

2017-03-22 Thread Jan Kara
Make wb->bdi a proper refcounted reference to bdi for all bdi_writeback structures except for the one embedded inside struct backing_dev_info. That will allow us to simplify bdi unregistration. Acked-by: Tejun Heo Signed-off-by: Jan Kara --- mm/backing-dev.c | 13

[PATCH 01/10] block: Fix bdi assignment to bdev inode when racing with disk delete

2017-03-22 Thread Jan Kara
When disk->fops->open() in __blkdev_get() returns -ERESTARTSYS, we restart the process of opening the block device. However we forget to switch bdev->bd_bdi back to noop_backing_dev_info and as a result bdev inode will be pointing to a stale bdi. Fix the problem by setting bdev->bd_bdi later when

[PATCH 05/10] bdi: Shutdown writeback on all cgwbs in cgwb_bdi_destroy()

2017-03-22 Thread Jan Kara
Currently we waited for all cgwbs to get freed in cgwb_bdi_destroy() which also means that writeback has been shutdown on them. Since this wait is going away, directly shutdown writeback on cgwbs from cgwb_bdi_destroy() to avoid live writeback structures after bdi_unregister() has finished. To

[PATCH 10/10] block: Fix oops scsi_disk_get()

2017-03-22 Thread Jan Kara
When device open races with device shutdown, we can get the following oops in scsi_disk_get(): [11863.044351] general protection fault: [#1] SMP [11863.045561] Modules linked in: scsi_debug xfs libcrc32c netconsole btrfs raid6_pq zlib_deflate lzo_compress xor [last unloaded: loop]

[PATCH 09/10] kobject: Export kobject_get_unless_zero()

2017-03-22 Thread Jan Kara
Make the function available for outside use and fortify it against NULL kobject. CC: Greg Kroah-Hartman Reviewed-by: Bart Van Assche Acked-by: Tejun Heo Signed-off-by: Jan Kara --- include/linux/kobject.h

[PATCH 06/10] bdi: Do not wait for cgwbs release in bdi_unregister()

2017-03-22 Thread Jan Kara
Currently we wait for all cgwbs to get released in cgwb_bdi_destroy() (called from bdi_unregister()). That is however unnecessary now when cgwb->bdi is a proper refcounted reference (thus bdi cannot get released before all cgwbs are released) and when cgwb_bdi_destroy() shuts down writeback

Re: [PATCH rfc 03/10] nvme-pci: open-code polling logic in nvme_poll

2017-03-22 Thread Christoph Hellwig
Looks fine, Reviewed-by: Christoph Hellwig

Re: [PATCH rfc 02/10] nvme-pci: Add budget to __nvme_process_cq

2017-03-22 Thread Christoph Hellwig
Looks good, Reviewed-by: Christoph Hellwig

Re: [PATCH rfc 01/10] nvme-pci: Split __nvme_process_cq to poll and handle

2017-03-22 Thread Christoph Hellwig
Looks fine, Reviewed-by: Christoph Hellwig

[PATCH 5/5] blk-mq: streamline blk_mq_make_request

2017-03-22 Thread Christoph Hellwig
Turn the different ways of merging or issuing I/O into a series of if/else statements instead of the current maze of gotos. Note that this means we pin the CPU a little longer for some cases as the CTX put is moved to common code at the end of the function. Signed-off-by: Christoph Hellwig

[PATCH 2/5] blk-mq: merge mq and sq make_request instances

2017-03-22 Thread Christoph Hellwig
They are mostly the same code anyway - this just one small conditional for the plug case that is different for both variants. Signed-off-by: Christoph Hellwig --- block/blk-mq.c | 164 +++-- 1 file changed, 31 insertions(+), 133

[PATCH 4/5] blk-mq: split the plug and sync cases in blk_mq_make_request

2017-03-22 Thread Christoph Hellwig
Now that we have a nice direct issue heper this helps simplifying the code a bit, and also gets rid of the old_rq variable. Signed-off-by: Christoph Hellwig --- block/blk-mq.c | 36 ++-- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git

unify and streamline the blk-mq make_request implementations V3

2017-03-22 Thread Christoph Hellwig
A bunch of cleanups to get us a nice I/O submission path. Changes since V2: - really address the comments from Bart - address another comment from Bart Changes since V1: - rebase on top of the recent blk_mq_try_issue_directly changes - incorporate comments from Bart

[PATCH 3/5] blk-mq: improve blk_mq_try_issue_directly

2017-03-22 Thread Christoph Hellwig
Rename blk_mq_try_issue_directly to __blk_mq_try_issue_directly and add a new wrapper that takes care of RCU / SRCU locking to avoid having boileplate code in the caller which would get duplicated with new callers. Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche

[PATCH 1/5] blk-mq: remove BLK_MQ_F_DEFER_ISSUE

2017-03-22 Thread Christoph Hellwig
This flag was never used since it was introduced. Signed-off-by: Christoph Hellwig Reviewed-by: Bart Van Assche Reviewed-by: Johannes Thumshirn --- block/blk-mq.c | 8 +--- include/linux/blk-mq.h | 1 - 2 files changed,

Re: unify and streamline the blk-mq make_request implementations V2

2017-03-22 Thread h...@lst.de
On Tue, Mar 21, 2017 at 12:40:17PM +, Bart Van Assche wrote: > On Mon, 2017-03-20 at 16:39 -0400, Christoph Hellwig wrote: > > Changes since V1: > >  - rebase on top of the recent blk_mq_try_issue_directly changes > >  - incorporate comments from Bart > > Hi Christoph, > > It seems to me

Re: support ranges TRIM for libata

2017-03-22 Thread Christoph Hellwig
On Tue, Mar 21, 2017 at 02:59:01PM -0400, Tejun Heo wrote: > I do like the fact that this is a lot simpler than the previous > implementation but am not quite sure we want to deviate significantly > from what we do for other commands (command translation). Is it > because fixing the existing

Re: [PATCH] blk-mq: don't complete un-started request in timeout handler

2017-03-22 Thread Jens Axboe
On 03/22/2017 11:58 AM, Keith Busch wrote: > On Tue, Mar 21, 2017 at 11:03:59PM -0400, Jens Axboe wrote: >> On 03/21/2017 10:14 PM, Ming Lei wrote: >>> When iterating busy requests in timeout handler, >>> if the STARTED flag of one request isn't set, that means >>> the request is being processed

Re: [PATCH] blk-mq: don't complete un-started request in timeout handler

2017-03-22 Thread Keith Busch
On Tue, Mar 21, 2017 at 11:03:59PM -0400, Jens Axboe wrote: > On 03/21/2017 10:14 PM, Ming Lei wrote: > > When iterating busy requests in timeout handler, > > if the STARTED flag of one request isn't set, that means > > the request is being processed in block layer or driver, and > > isn't

Re: [PATCH] block: trace completion of all bios.

2017-03-22 Thread Christoph Hellwig
On Wed, Mar 22, 2017 at 01:38:09PM +1100, NeilBrown wrote: > > Currently only dm and md/raid5 bios trigger trace_block_bio_complete(). > Now that we have bio_chain(), it is not possible, in general, for a > driver to know when the bio is really complete. Only bio_endio() > knows that. > > So