[PATCH 0/20] Use block pr_ops in LIO

Mike Christie
2022-08-09T00:04:55Z

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-ab337f514fc5@oracle.com/T/#meebd5040bc360f8c86532b792b48dbe3efe88619

The patches allow us to use the block pr_ops with LIO's target_core_iblock
module to support cluster applications in VMs. Currently, to use windows
clustering or linux clustering (pacemaker + cluster labs scsi fence agents)
in VMs with LIO and vhost-scsi, you have to use tcmu or pscsi or use a
cluster aware FS/framework for the LIO pr file. Setting up a cluster
FS/framework is pain and waste when your real backend device is already a
distributed device, and pscsi and tcmu are nice for specific use cases,
but iblock gives you the best performance and allows you to use stacked
devices like dm-multipath. So these patches allow iblock to work like
pscsi/tcmu where they can pass a PR command to the backend module. And
then iblock will use the pr_ops to pass the PR command to the real devices
similar to what we do for unmap today.

The patches are separated in the following groups:

patches 1 - 11
- Add callouts to read a reservation and it's keys.

patches 12 - 16
- Have pr_ops return a blk_status_t.

patches 17 - 20
- Support for target_core_iblock to bypass the emulate PR code and call
the pr_ops.

This patchset has been tested with the libiscsi PGR ops and with window's
failover cluster verification test.

v2:
- Drop BLK_STS_NEXUS rename changes. Will do separately.
- Add NVMe support.
- Fixed bug in target_core_iblock where a variable was not initialized
mentioned by Christoph.
- Fixed sd pr_ops UA handling issue found when running libiscsi PGR tests.
- Added patches to allow pr_ops to pass up a BLK_STS so we could return
a RESERVATION_CONFLICT status when a pr_ops callout fails.