Skip to content

scsi: clean up persistent reservation state after migration

Stefan Hajnoczi qemu-devel 2 versions – Applied

Status from this message: Queued, thanks.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest8 patches 11 repliesApplied
  2. v18 patches 9 repliesSuperseded

Changes in v2 from the cover letter

- 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)

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/8pr-manager-helper: fix sense buffer overflowscsi/pr-manager-helper.c+2 -10 replies
2/8scsi: increase sense buffer size in scsi_SG_IO()hw/scsi/scsi-generic.c+13 -100 replies
3/8hw/scsi-disk: move MIG_EVENT_FAILED into a new functionhw/scsi/scsi-disk.c+16 -101 reply
4/8qemu-pr-helper: add PR_HELPER_CLEANUP for live migrationhw/scsi/scsi-bus.c include/scsi/constants.h meson.build +2 more+153 -93 replies
5/8pr-manager-helper: add PR_HELPER_CLEANUP command supportscsi/pr-manager-helper.c scsi/utils.c+20 -31 reply
6/8file-posix: forward PR_HELPER_CLEANUP commands to pr-managerblock/file-posix.c+13 -51 reply
7/8scsi: clean up persistent reservation state after migrationhw/scsi/scsi-disk.c hw/scsi/scsi-generic.c include/hw/scsi/scsi.h+50 -11 reply
8/8scsi: use REGISTER AND IGNORE EXISTING KEY for robustnesshw/scsi/scsi-generic.c+7 -51 reply

Reviews trailers per patch

All 8 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchEric Blake
SeriesR-b
1/8R-b
2/8R-b
3/8R-b
4/8R-b
5/8R-b
6/8R-b
7/8R-b
8/8R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/8] scsi: clean up persistent reservation state after migration

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.

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(-)
Signature · 1 line
2.56.0