Re: [PATCH] scsi: fc: check for rport presence in fc_block_scsi_eh

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 14:00 +0200, Johannes Thumshirn wrote: > Coverity-scan recently found a possible NULL pointer dereference in > fc_block_scsi_eh() as starget_to_rport() either returns the rport for > the startget or NULL. > > While it is rather unlikely to have fc_block_scsi_eh() called

Re: [PATCH] mpt3sas: remove redundant copy_from_user in _ctl_getiocinfo

2017-09-25 Thread Martin K. Petersen
Meng, > Since right after the user copy, we are going to > memset(, 0, sizeof(karg)), the copy_from_user is redundant Applied to 4.15/scsi-queue. Thank you! -- Martin K. Petersen Oracle Linux Engineering

Re: [RFC] apparently broken error recovery in vhost_scsi_iov_to_sgl()

2017-09-25 Thread Michael S. Tsirkin
On Sun, Sep 24, 2017 at 11:36:33PM +0100, Al Viro wrote: > Suppose vhost_scsi_iov_to_sgl() got a two-iovec array, mapped > e.g. 20 pages from the first one just fine and failed on the > second. > > static int > vhost_scsi_iov_to_sgl(struct vhost_scsi_cmd *cmd, bool write, >

Re: [PATCH V5 13/14] block: mq-deadline: Limit write request dispatch for zoned block devices

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 15:14 +0900, Damien Le Moal wrote: > - return rq_entry_fifo(dd->fifo_list[data_dir].next); > + if (!dd->zones_wlock || data_dir == READ) > + return rq_entry_fifo(dd->fifo_list[data_dir].next); > + > + spin_lock_irqsave(>zone_lock, flags); > + > +

Re: [PATCH] scsi_transport_fc: set scsi_target_id upon rescan

2017-09-25 Thread Martin K. Petersen
Hannes, > When an rport is found in the bindings array there is no guarantee > that it had been a target port, so we need to call > fc_remote_port_rolechg() here to ensure the scsi_target_id is set > correctly. Otherwise the port will never be scanned. Applied to 4.14/scsi-fixes. Thank you!

Re: [PATCH v4 00/14] mpt3sas driver NVMe support:

2017-09-25 Thread Martin K. Petersen
Hi Suganath, > Also, Making all PRP buffer may or may not need FW changes (assuming > it is possible.), we may end up into multiple FW version check. I don't understand how submitting an I/O that is guaranteed to honor the constraints of the target NVMe drive could possibly cause problems for

Re: [PATCH V5 06/14] block: Add zoned block device information to request queue

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 15:14 +0900, Damien Le Moal wrote: > Components relying only on the requeuest_queue structure for accessing > block devices (e.g. I/O schedulers) have a limited knowledged of the > device characteristics. In particular, the device capacity cannot be > easily discovered, which

Re: [PATCH 3/6] scsi: lpfc: Cocci spatch "pool_zalloc-simple"

2017-09-25 Thread Martin K. Petersen
Thomas, > Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0. > Found by coccinelle spatch "api/alloc/pool_zalloc-simple.cocci" Applied to 4.15/scsi-queue. Thank you! -- Martin K. Petersen Oracle Linux Engineering

Re: [PATCH] scsi: aacraid: Add a small delay after IOP reset

2017-09-25 Thread Guilherme G. Piccoli
On 09/21/2017 01:19 PM, Dave Carroll wrote: >> [...] >> --- > Acked-by: Dave Carroll > Thanks Dave! James/Martin, am I expected to send a v2 with some change? Perhaps with Dave's ack? Sorry to annoy, thanks in advance for any advice! Cheers, Guilherme

Re: [PATCH V5 12/14] block: mq-deadline: Introduce zone locking support

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 15:14 +0900, Damien Le Moal wrote: > +static inline bool deadline_request_needs_zone_wlock(struct deadline_data > *dd, > + struct request *rq) > +{ > + > + if (!dd->zones_wlock) > + return false; > + > + if

Re: [PATCH 5/6] scsi: qla2xxx: Cocci spatch "pool_zalloc-simple"

2017-09-25 Thread Martin K. Petersen
Thomas, > Use *_pool_zalloc rather than *_pool_alloc followed by memset with 0. > Found by coccinelle spatch "api/alloc/pool_zalloc-simple.cocci" Applied to 4.15/scsi-queue. Thanks! -- Martin K. Petersen Oracle Linux Engineering

Re: [PATCH V5 03/14] scsi: sd_zbc: Rearrange code

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 15:14 +0900, Damien Le Moal wrote: > Rearrange sd_zbc_setup() to include use_16_for_rw and use_10_for_rw > assignments and move the calculation of sdkp->zone_shift together > with the assignment of the verified zone_blocks value in > sd_zbc_check_zone_size(). > > No

Re: [PATCH V5 07/14] scsi: sd_zbc: Initialize device request queue zoned data

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 15:14 +0900, Damien Le Moal wrote: > + return kzalloc_node(BITS_TO_LONGS(sdkp->nr_zones) > + * sizeof(unsigned long), Does this perhaps fit on one line? > +/** > + * sd_zbc_get_seq_zones - Parse report zones reply to identify sequential > zones

Re: [PATCH V5 11/14] blokc: mq-deadline: Introduce dispatch helpers

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 15:14 +0900, Damien Le Moal wrote: > Avoid directly referencing the next_rq and fifo_list arrays using the > helper functions deadline_next_request() and deadline_fifo_request() to > facilitate changes in the dispatch request selection in > __dd_dispatch_request().

Re: [PATCH 0/2] scsi_dh: suppress errors from unsupported devices

2017-09-25 Thread Martin K. Petersen
Hannes, > here's a small patchset to suppress errors from scsi_dh_attach() for > unsupported devices. Applied to 4.15/scsi-queue. Thank you! -- Martin K. Petersen Oracle Linux Engineering

Re: [PATCH] scsi_transport_fc: Also check for NOTPRESENT in fc_remote_port_add()

2017-09-25 Thread Martin K. Petersen
Hannes, > During failover there is a small race window between > fc_remote_port_add() and fc_timeout_deleted_rport(); the latter drops > the lock after setting the port to NOTPRESENT, so if > fc_remote_port_add() is called right at that time it will fail to > detect the existing rport and

Re: [PATCH V7 1/2] dma-mapping: Rework dma_get_cache_alignment()

2017-09-25 Thread 陈华才
Hi, Robin, Can ARM/ARM64 use the same implementation as MIPS? Or I just do MIPS things is OK? Huacai -- Original -- From: "Robin Murphy"; Date: Mon, Sep 25, 2017 08:57 PM To: "Huacai Chen"; "Christoph

Re: [PATCH] sd: Limit WRITE SAME / WRITE SAME(16) w/UNMAP length for certain devices

2017-09-25 Thread Martin K. Petersen
Ewan, > Some devices do not support a WRITE SAME / WRITE SAME(16) with the > UNMAP bit set up to the length specified in the MAXIMUM WRITE SAME > LENGTH field in the block limits VPD page (or, the field is zero, > indicating there is no limit). Limit the length by the MAXIMUM UNMAP > LBA COUNT

Re: [PATCH V7 1/2] dma-mapping: Rework dma_get_cache_alignment()

2017-09-25 Thread 陈华才
Hi, Christoph, Can I put the declaration in asm/dma-coherence.h? And, last time you said it is OK to pass a NULL to dma_get_cache_alignment() and cc all driver maintainers. I have do so. Huacai -- Original -- From: "Christoph Hellwig"; Date: Mon,

Re: [PATCH V7 1/2] dma-mapping: Rework dma_get_cache_alignment()

2017-09-25 Thread Christoph Hellwig
> index aba7138..e2c5d9e 100644 > --- a/arch/mips/include/asm/dma-mapping.h > +++ b/arch/mips/include/asm/dma-mapping.h > @@ -39,4 +39,6 @@ static inline void arch_setup_dma_ops(struct device *dev, > u64 dma_base, > #endif > } > > +int mips_get_cache_alignment(struct device *dev); All the

Re: [PATCH V7 1/2] dma-mapping: Rework dma_get_cache_alignment()

2017-09-25 Thread Robin Murphy
On 25/09/17 10:46, Huacai Chen wrote: > Make dma_get_cache_alignment() to accept a 'dev' argument. As a result, > it can return different alignments due to different devices' I/O cache > coherency. > > Currently, MIPS is the only architecture which support coherent & non- > coherent devices

[PATCH V7 2/2] scsi: Align block queue to dma_get_cache_alignment()

2017-09-25 Thread Huacai Chen
In non-coherent DMA mode, kernel uses cache flushing operations to maintain I/O coherency, so scsi's block queue should be aligned to ARCH_DMA_MINALIGN. Otherwise, it will cause data corruption, at least on MIPS: Step 1, dma_map_single Step 2, cache_invalidate (no writeback)

Re: [PATCH 07/19] lpfc: Move CQ processing to a soft IRQ

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham

Re: [PATCH 08/19] lpfc: Fix FCP hba_wqidx assignment

2017-09-25 Thread Johannes Thumshirn
Again, if this is fixing an oops it should be tagged for inclusion into stable. Byte, Johannes -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF:

Re: [PATCH 09/19] lpfc: Reduce log spew on controller reconnects

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham

Re: [PATCH 10/19] lpfc: Set missing abort context

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham

Re: [PATCH 12/19] lpfc: Fix oops if nvmet_fc_register_targetport fails

2017-09-25 Thread Johannes Thumshirn
CC: stable? Anyways, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane

Re: [PATCH 11/19] lpfc: Revise NVME module parameter descriptions for better clarity

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham

Re: [PATCH 13/19] lpfc: Disable NPIV support if NVME is enabled

2017-09-25 Thread Johannes Thumshirn
On Thu, Sep 21, 2017 at 11:17:35PM -0700, James Smart wrote: > Support for NPIV with NVME will be added in the near future. Sounds like the future is bright, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage

Re: [PATCH 14/19] lpfc: Fix crash in lpfc_nvme_fcp_io_submit during LIP

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham

Re: [PATCH 16/19] lpfc: Ensure io aborts interlocked with the target.

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham

Re: [PATCH 17/19] lpfc: Extend RDP support

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham

Re: [PATCH 15/19] lpfc: Fix secure firmware updates

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham

Re: [PATCH 18/19] lpfc: Fix oops of nvme host during driver unload.

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn But again, this should be considered for inclusion into stable -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr.

Re: [PATCH 19/19] lpfc: change version to 11.4.0.4

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham

Re: scsi: fix the issue that iscsi_if_rx doesn't parse nlmsg properly

2017-09-25 Thread Vladis Dronov
hello, an additional research shows that the very latest kernels are not showing a crash with a reproducer. git bisect showed that: commit 7f564528a480084e2318cd48caba7aef4a54a77f is the first commit (between v4.11 and v4.12-rc1) a crash is not reproduced with: commit

Re: [PATCH 1/1] bsg-lib: fix use-after-free under memory-pressure

2017-09-25 Thread Christoph Hellwig
> if (!q) > return ERR_PTR(-ENOMEM); > q->cmd_size = sizeof(struct bsg_job) + dd_job_size; > - q->init_rq_fn = bsg_init_rq; > - q->exit_rq_fn = bsg_exit_rq; > + q->init_rq_fn = bsg_init_job; > + q->exit_rq_fn = bsg_exit_job; > + q->initialize_rq_fn =

Re: [PATCH 1/1] bsg-lib: fix use-after-free under memory-pressure

2017-09-25 Thread Benjamin Block
On Mon, Sep 25, 2017 at 08:53:07AM -0700, Christoph Hellwig wrote: > > if (!q) > > return ERR_PTR(-ENOMEM); > > q->cmd_size = sizeof(struct bsg_job) + dd_job_size; > > - q->init_rq_fn = bsg_init_rq; > > - q->exit_rq_fn = bsg_exit_rq; > > + q->init_rq_fn = bsg_init_job; >

Re: [PATCH] scsi: fix the issue that iscsi_if_rx doesn't parse nlmsg properly

2017-09-25 Thread Martin K. Petersen
Xin, > ChunYu found a kernel crash by syzkaller: [...] > It's caused by skb_shared_info at the end of sk_buff was overwritten by > ISCSI_KEVENT_IF_ERROR when parsing nlmsg info from skb in iscsi_if_rx. > > During the loop if skb->len == nlh->nlmsg_len and both are sizeof(*nlh), > ev =

Re: [PATCH] scsi: ufs: Make use of UFS_BIT macro wherever possible

2017-09-25 Thread Martin K. Petersen
Alim, > Should I drop this patch and send another one which removes UFS_BIT() > macro? I fail to see the point of UFS_BIT(). So yes. Please make sure to CC: Subhash on ufs changes. -- Martin K. Petersen Oracle Linux Engineering

Re: [PATCH] scsi: csiostor: enable PCIe relax ordering if supported

2017-09-25 Thread Martin K. Petersen
Varun, > Set PCIe relax ordering bits in FW_IQ_CMD if relax ordering is enabled > in the PCIe device. Applied to 4.15/scsi-queue. Thank you! -- Martin K. Petersen Oracle Linux Engineering

Re: [PATCH V3 1/2] scsi: sd: Fix sd_config_write_same()

2017-09-25 Thread Martin K. Petersen
Damien, > Reporting a maximum number of blocks that is not aligned on the device > physical size would cause a large write same request to be split into > physically unaligned chunks by __blkdev_issue_write_zeroes() and > __blkdev_issue_write_same(), even if the caller of these functions > took

Re: [PATCH V5 10/14] block: mq-deadline: Add zoned block device data

2017-09-25 Thread Bart Van Assche
On Mon, 2017-09-25 at 15:14 +0900, Damien Le Moal wrote: > Modify mq-dealine init_queue and exit_queue elevator methods to handle ^^ mq-deadline ? > +static int deadline_init_zones_wlock(struct request_queue *q, > + struct deadline_data

Re: [PATCH] scsi: aacraid: Add a small delay after IOP reset

2017-09-25 Thread Martin K. Petersen
Guilherme, > James/Martin, am I expected to send a v2 with some change? Perhaps > with Dave's ack? Sorry to annoy, thanks in advance for any advice! I was just about to mail Dave and ask for confirmation that your interpretation of the controller behavior is correct. Dave? -- Martin K.

Re: [PATCH V2 0/9] pm80xx updates

2017-09-25 Thread Martin K. Petersen
Viswas, > Do we need to send V3 patch set with corrected date ? Yes, please. And address Jack's/kbuild robot's comments. Thanks! -- Martin K. Petersen Oracle Linux Engineering

[PATCH V7 1/2] dma-mapping: Rework dma_get_cache_alignment()

2017-09-25 Thread Huacai Chen
Make dma_get_cache_alignment() to accept a 'dev' argument. As a result, it can return different alignments due to different devices' I/O cache coherency. Currently, MIPS is the only architecture which support coherent & non- coherent devices co-exist. This may be changed in the future, so add a

Re: [PATCH V5 06/14] block: Add zoned block device information to request queue

2017-09-25 Thread Ming Lei
On Mon, Sep 25, 2017 at 03:14:46PM +0900, Damien Le Moal wrote: > Components relying only on the requeuest_queue structure for accessing > block devices (e.g. I/O schedulers) have a limited knowledged of the > device characteristics. In particular, the device capacity cannot be > easily

Re: [PATCH 01/19] lpfc: Fix crash in pci hot plug situations

2017-09-25 Thread Johannes Thumshirn
This probably should be two patches and both CCed to stable. Byte, Johannes -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer,

Re: [PATCH 02/19] lpfc: Fix crash receiving ELS while detaching driver

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn But should probably go into stable as well. -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg

Re: [PATCH 04/19] lpfc: Fix warning messages when NVME_TARGET_FC not defined

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham

Re: [PATCH 03/19] lpfc: Fix lpfc nvme host rejecting IO with Not Ready message

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham

Re: [PATCH 05/19] lpfc: PLOGI failures during NPIV testing

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn But maybe worth adding a: Fixes: 4042629e426d ("[SCSI] lpfc 8.3.20: Updates to FC discovery commands") Byte, Johannes -- Johannes Thumshirn Storage jthumsh...@suse.de

RE: [PATCH V2] megaraid: kmemleak: Track page allocation for fusion

2017-09-25 Thread Shivasharan Srikanteshwara
> -Original Message- > From: Christoph Hellwig [mailto:h...@infradead.org] > Sent: Monday, September 18, 2017 9:52 PM > To: Shivasharan Srikanteshwara > Cc: Christoph Hellwig; shuw...@redhat.com; Kashyap Desai; Sumit Saxena; > j...@linux.vnet.ibm.com; martin.peter...@oracle.com; >

Re: [PATCH V4 02/16] scsi: sd_zbc: Fix comments and indentation

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham

Re: [PATCH V4 03/16] scsi: sd_zbc: Rearrange code

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham

[PATCH] scsi_transport_fc: Also check for NOTPRESENT in fc_remote_port_add()

2017-09-25 Thread Hannes Reinecke
During failover there is a small race window between fc_remote_port_add() and fc_timeout_deleted_rport(); the latter drops the lock after setting the port to NOTPRESENT, so if fc_remote_port_add() is called right at that time it will fail to detect the existing rport and happily adding a new

Re: [PATCH] scsi_transport_fc: Also check for NOTPRESENT in fc_remote_port_add()

2017-09-25 Thread Johannes Thumshirn
Looks good, Reviewed-by: Johannes Thumshirn -- Johannes Thumshirn Storage jthumsh...@suse.de+49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham

[PATCH] scsi: fc: check for rport presence in fc_block_scsi_eh

2017-09-25 Thread Johannes Thumshirn
Coverity-scan recently found a possible NULL pointer dereference in fc_block_scsi_eh() as starget_to_rport() either returns the rport for the startget or NULL. While it is rather unlikely to have fc_block_scsi_eh() called without an rport associated it's a good idea to catch potential misuses of

[PATCH V5 04/14] scsi: sd_zbc: Use well defined macros

2017-09-25 Thread Damien Le Moal
instead of open coding, use the min() macro to calculate a report zones reply buffer length in sd_zbc_check_zone_size() and the round_up() macro for calculating the number of zones in sd_zbc_setup(). No functional change is introduced by this patch. Signed-off-by: Damien Le Moal

[PATCH V5 11/14] blokc: mq-deadline: Introduce dispatch helpers

2017-09-25 Thread Damien Le Moal
Avoid directly referencing the next_rq and fifo_list arrays using the helper functions deadline_next_request() and deadline_fifo_request() to facilitate changes in the dispatch request selection in __dd_dispatch_request(). Signed-off-by: Damien Le Moal ---

[PATCH V5 13/14] block: mq-deadline: Limit write request dispatch for zoned block devices

2017-09-25 Thread Damien Le Moal
When dispatching writes to a zoned block device, only allow the request to be dispatched if its target zone is not locked. If it is, leave the request in the scheduler queue and look for another suitable write request. If no write can be dispatched, allow reads to be dispatched even if the write

[PATCH V5 05/14] scsi: sd_zbc: Fix sd_zbc_read_zoned_characteristics()

2017-09-25 Thread Damien Le Moal
The three values starting at byte 8 of the Zoned Block Device Characteristics VPD page B6h are 32 bits values, not 64bits. So use get_unaligned_be32() to retrieve the values and not get_unaligned_be64() Fixes: 89d947561077 ("sd: Implement support for ZBC devices") Cc:

[PATCH V5 14/14] block: do not set mq default scheduler

2017-09-25 Thread Damien Le Moal
For blk-mq disks with a single hardware queue, setting by default the disk scheduler to mq-deadline early during the queue initialization prevents properly setting zone write locking for host managed zoned block device as the disk type is not yet known. Fix this by simply not setting the default

[PATCH V5 00/14] scsi-mq support for ZBC disks

2017-09-25 Thread Damien Le Moal
This series implements support for ZBC disks used through the scsi-mq I/O path. The current scsi level support of ZBC disks guarantees write request ordering using a per-zone write lock which prevents issuing simultaneously multiple write commands to a zone, doing so avoid reordering of

[PATCH V5 02/14] scsi: sd_zbc: Fix comments and indentation

2017-09-25 Thread Damien Le Moal
Fix comments style (use kernel-doc style) and content to clarify some functions. Also fix some functions signature indentation and remove a useless blank line in sd_zbc_read_zones(). No functional change is introduced by this patch. Signed-off-by: Damien Le Moal

[PATCH V5 07/14] scsi: sd_zbc: Initialize device request queue zoned data

2017-09-25 Thread Damien Le Moal
Initialize the seq_zone_bitmap and nr_zones fields of the disk request queue on disk revalidate. As the seq_zone_bitmap allocation is identical to the allocation of the zone write lock bitmap, introduce the helper sd_zbc_alloc_zone_bitmap(). Using this helper, wait for the disk capacity and number

[PATCH V5 06/14] block: Add zoned block device information to request queue

2017-09-25 Thread Damien Le Moal
Components relying only on the requeuest_queue structure for accessing block devices (e.g. I/O schedulers) have a limited knowledged of the device characteristics. In particular, the device capacity cannot be easily discovered, which for a zoned block device also result in the inability to easily

[PATCH V5 01/14] scsi: sd_zbc: Move ZBC declarations to scsi_proto.h

2017-09-25 Thread Damien Le Moal
Move standard macro definitions for the zone types and zone conditions to scsi_proto.h together with the definitions related to the REPORT ZONES command. While at it, define all values in the enums to be clear. Also remove unnecessary includes in sd_zbc.c. No functional change is introduced by

[PATCH V5 09/14] scsi: sd_zbc: Disable zone write locking with scsi-mq

2017-09-25 Thread Damien Le Moal
In the case of a ZBC disk used with scsi-mq, zone write locking does not prevent write reordering in sequential zones. Unlike the legacy case, zone locking is done after the command request is removed from the scheduler dispatch queue. That is, at the time of zone locking, the write command may

[PATCH V5 03/14] scsi: sd_zbc: Rearrange code

2017-09-25 Thread Damien Le Moal
Rearrange sd_zbc_setup() to include use_16_for_rw and use_10_for_rw assignments and move the calculation of sdkp->zone_shift together with the assignment of the verified zone_blocks value in sd_zbc_check_zone_size(). No functional change is introduced by this patch. Signed-off-by: Damien Le Moal

[PATCH V5 12/14] block: mq-deadline: Introduce zone locking support

2017-09-25 Thread Damien Le Moal
For a write request to a zoned block device, lock the request target zone upon request displatch. The zone is unlocked either when the request completes or when the request is requeued (inserted). To indicate that a request has locked its target zone, use the first pointer of the request elevator

[PATCH V5 08/14] scsi: sd_zbc: Limit zone write locking to sequential zones

2017-09-25 Thread Damien Le Moal
Conventional zones of zoned block devices have no write constraints. Write locking of conventional zones is thus not necessary and can even hurt performance by unnecessarily operating the disk under low queue depth. To avoid this, use the disk request queue seq_zone_bitmap to allow any write to be

[PATCH V5 10/14] block: mq-deadline: Add zoned block device data

2017-09-25 Thread Damien Le Moal
Introduce new fields to mq-deadline private data to support zoned block devices. The fields are a zone bitmap used to implement zone write locking and a spinlock to atomically handle zone write locking with other processing. Modify mq-dealine init_queue and exit_queue elevator methods to handle