[dm-devel] [PATCH v2 08/20] nvme: Add helper to convert to a pr_ops PR type

2022-08-08 Thread Mike Christie
This adds a helper to go from the NVMe spec PR type value to the block layer pr_type, so for Reservation Report support we can convert from its value. Signed-off-by: Mike Christie --- drivers/nvme/host/core.c | 20 1 file changed, 20 insertions(+) diff --git a/drivers/nvme/

[dm-devel] [PATCH v2 11/20] nvme: Add pr_ops read_reservation support

2022-08-08 Thread Mike Christie
This patch adds support for the pr_ops read_reservation callout by calling the NVMe Reservation Report helper. It then parses that info to detect if there is a reservation and if there is then convert the returned info to a pr_ops pr_held_reservation struct. Signed-off-by: Mike Christie --- driv

[dm-devel] [PATCH v2 20/20] scsi: target: Add block PR support to iblock.

2022-08-08 Thread Mike Christie
This adds support for the block PR callouts to target_core_iblock. This patch doesn't attempt to implement the entire spec because there's no way support it all like SPEC_I_PT and ALL_TG_PT. This only supports exporting the iblock device from one path on the local target. Signed-off-by: Mike Chris

[dm-devel] [PATCH v2 15/20] scsi: Export scsi_result_to_blk_status.

2022-08-08 Thread Mike Christie
Export scsi_result_to_blk_status so the sd pr_ops can get a BLK_STS error that can be returned to other kernel pr ops users. Signed-off-by: Mike Christie --- drivers/scsi/scsi_lib.c | 3 ++- include/scsi/scsi_cmnd.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/sc

[dm-devel] [PATCH v2 10/20] nvme: Add pr_ops read_keys support

2022-08-08 Thread Mike Christie
This patch adds support for the pr_ops read_keys callout by calling the NVMe Reservation Report helper, then parsing that info to get the controller's registered keys. Because the callout is only used in the kernel where the callers do not know about controller/host IDs, the callout just returns th

[dm-devel] [PATCH v2 13/20] nvme: Have nvme pr_ops return a blk_status_t

2022-08-08 Thread Mike Christie
This patch has the nvme pr_ops convert from a nvme status value to a blk_status_t. Signed-off-by: Mike Christie --- drivers/nvme/host/core.c | 54 ++-- 1 file changed, 36 insertions(+), 18 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host

[dm-devel] [PATCH v2 02/20] scsi: Rename sd_pr_command.

2022-08-08 Thread Mike Christie
Rename sd_pr_command to sd_pr_out_command to match a sd_pr_in_command helper added in the next patches. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/

[dm-devel] [PATCH v2 09/20] nvme: Add helper to execute Reservation Report

2022-08-08 Thread Mike Christie
This adds a helper to execute the Reservation Report. The next patches will then convert call it and convert that info to read_keys and read_reservation. Signed-off-by: Mike Christie --- drivers/nvme/host/core.c | 27 +++ 1 file changed, 27 insertions(+) diff --git a/dri

[dm-devel] [PATCH v2 14/20] scsi: Retry pr_ops commands if a UA is returned.

2022-08-08 Thread Mike Christie
It's common to get a UA when doing PR commands. It could be due to a target restarting, transport level relogin or other PR commands like a release causing it. The upper layers don't get the sense and in some cases have no idea if it's a SCSI device, so this has the sd layer retry. Signed-off-by:

[dm-devel] [PATCH v2 12/20] block, nvme, scsi, dm: Add blk_status to pr_ops callouts.

2022-08-08 Thread Mike Christie
Kernel pr_ops users like LIO need to be able to know about if a failure was a result of a reservation conflict and then be able to convert from the lower level's definition of that error to SCSI so it can be returned to the initiator. To do this they currently have to know the lower level device ty

[dm-devel] [PATCH v2 17/20] scsi: target: Rename sbc_ops to exec_cmd_ops

2022-08-08 Thread Mike Christie
The next patches allow us to call the block layer's pr_ops from the backends. This will require allowing the backends to hook into the cmd processing for SPC commands, so this renames sbc_ops to a more generic exec_cmd_ops. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers

[dm-devel] [PATCH v2 18/20] scsi: target: Allow backends to hook into PR handling.

2022-08-08 Thread Mike Christie
For the cases where you want to export a device to a VM via a single I_T nexus and want to passthrough the PR handling to the physical/real device you have to use pscsi or tcmu. Both are good for specific uses however for the case where you want good performance, and are not using SCSI devices dire

[dm-devel] [PATCH v2 19/20] scsi: target: Don't support SCSI-2 RESERVE/RELEASE

2022-08-08 Thread Mike Christie
The pr_ops don't support SCSI-2 RESERVE/RELEASE so fail them during parsing. Signed-off-by: Mike Christie --- drivers/target/target_core_spc.c | 25 +++-- 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/drivers/target/target_core_spc.c b/drivers/target/target_c

[dm-devel] [PATCH v2 16/20] scsi: Have sd pr_ops return a blk_status_t

2022-08-08 Thread Mike Christie
This patch has the sd pr_ops convert from the low level SCSI errors to a blk_status_t. Signed-off-by: Mike Christie --- drivers/scsi/sd.c | 27 ++- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 61e88c7ffa44..31b

[dm-devel] [PATCH v2 05/20] dm: Add support for block PR read keys/reservation.

2022-08-08 Thread Mike Christie
This adds support in dm for the block PR read keys and read reservation callouts. Signed-off-by: Mike Christie --- drivers/md/dm.c | 44 1 file changed, 44 insertions(+) diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 60549b65c799..1b15295bdf24

[dm-devel] [PATCH 0/20] Use block pr_ops in LIO

2022-08-08 Thread Mike Christie
The following patches were built over Linus's tree and this patchset which fixes some scsi error handling issues: https://lore.kernel.org/linux-scsi/1136e369-49b0-c3ef-340a-ab337f514...@oracle.com/T/#meebd5040bc360f8c86532b792b48dbe3efe88619 The patches allow us to use the block pr_ops with LIO's

[dm-devel] [PATCH v2 06/20] nvme: Fix reservation status related structs

2022-08-08 Thread Mike Christie
This fixes the following issues with the reservation status structs: 1. resv10 is bytes 23:10 so it should be 14 bytes. 2. regctl_ds only supports 64 bit host IDs. Signed-off-by: Mike Christie --- include/linux/nvme.h | 33 + 1 file changed, 25 insertions(+), 8 d

[dm-devel] [PATCH v2 07/20] nvme: Don't hardcode the data len for pr commands.

2022-08-08 Thread Mike Christie
Reservation Report support needs to pass in a variable sized buffer, so this patch has the pr command helpers take a data length argument. Signed-off-by: Mike Christie --- drivers/nvme/host/core.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/nvme/hos

[dm-devel] [PATCH v2 03/20] scsi: Move sd_pr_type to header to share.

2022-08-08 Thread Mike Christie
LIO is going to want to do the same block to/from SCSI pr types as sd.c so this moves the sd_pr_type helper to a new file and adds a helper to go from the SCSI value to the block one. Signed-off-by: Mike Christie Reviewed-by: Christoph Hellwig --- drivers/scsi/sd.c| 29 +

[dm-devel] [PATCH v2 01/20] block: Add PR callouts for read keys and reservation

2022-08-08 Thread Mike Christie
Add callouts for reading keys and reservations. This allows LIO to support the READ_KEYS and READ_RESERVATION commands and will allow dm-multipath to optimize it's error handling so it can check if it's getting an error because there's an existing reservation or if we need to retry different paths.

[dm-devel] [PATCH v2 04/20] scsi: Add support for block PR read keys/reservation.

2022-08-08 Thread Mike Christie
This adds support in sd.c for the block PR read keys and read reservation callouts. Signed-off-by: Mike Christie --- drivers/scsi/sd.c | 88 +++ include/scsi/scsi_proto.h | 5 +++ 2 files changed, 93 insertions(+) diff --git a/drivers/scsi/sd.c b/dri

[dm-devel] [PATCH] dm-writecache: drop the lock on an 'impossible' path

2022-08-08 Thread Mikulas Patocka
On Fri, 5 Aug 2022, Dan Carpenter wrote: > tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git > master > head: b44f2fd87919b5ae6e1756d4c7ba2cbba22238e1 > commit: df699cc16ea5ef93a917676dcdd4376e02860ad5 dm writecache: report > invalid return from writecache_map helpe