v2:
- Explicitly reject PR_HELPER_CLEAN commands in scsi_req_new() because
this is an internal command that guests must not be able to invoke
- Move cdb[0] check after copy from io_hdr in pr-manager-helper.c
- Add missing endianness conversion for protocol flags in pr-manager-helper.c
- Ignore PR_HELPER_CLEANUP commands when there is no pr-manager to avoid
passing through this QEMU-internal vendor-specific command to the
underlying SCSI device.
- Add missing "forget" in comment (typo)
When a guest using SCSI persistent reservations is migrated on a Linux host
using multipathd, some state is left behind and this can cause multipathd to
register the old key again in the future. One way this can be observed is when
migrating a guest back-and-forth between two hosts: the REGISTER command will
fail when migrating back to the first host if the LUN is detached and
re-attached between migrations (i.e. multipathd sees that a path has come up).
This patch series modifies qemu-pr-helper to send multipathd commands that
clear the state once migration has completed successfully. This is implemented
as a vendor-specific SCSI command called PR_HELPER_CLEANUP that QEMU sends to
qemu-pr-helper just like PERSISTENT RESERVE IN and PERSISTENT RESERVE OUT
commands.
Buglink: https://redhat.atlassian.net/browse/RHEL-274966
Stefan Hajnoczi (8):
pr-manager-helper: fix sense buffer overflow
scsi: increase sense buffer size in scsi_SG_IO()
hw/scsi-disk: move MIG_EVENT_FAILED into a new function
qemu-pr-helper: add PR_HELPER_CLEANUP for live migration
pr-manager-helper: add PR_HELPER_CLEANUP command support
file-posix: forward PR_HELPER_CLEANUP commands to pr-manager
scsi: clean up persistent reservation state after migration
scsi: use REGISTER AND IGNORE EXISTING KEY for robustness
meson.build | 2 +
include/hw/scsi/scsi.h | 1 +
include/scsi/constants.h | 1 +
scsi/pr-helper.h | 3 +
block/file-posix.c | 18 +++--
hw/scsi/scsi-bus.c | 10 +++
hw/scsi/scsi-disk.c | 45 +++++++++---
hw/scsi/scsi-generic.c | 64 +++++++++++++----
scsi/pr-manager-helper.c | 23 ++++--
scsi/qemu-pr-helper.c | 146 ++++++++++++++++++++++++++++++++++++---
scsi/utils.c | 3 +
11 files changed, 273 insertions(+), 43 deletions(-)
--
2.56.0