Commit c6cae61e46 for qemu.org
commit c6cae61e469697df4f998ced2b017ebff3530526
Author: Stefan Hajnoczi <stefanha@redhat.com>
Date: Tue Oct 13 14:17:50 2026 -0400
file-posix: forward PR_HELPER_CLEANUP commands to pr-manager
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Link: https://lore.kernel.org/r/20261013181752.1299456-7-stefanha@redhat.com
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
diff --git a/block/file-posix.c b/block/file-posix.c
index 328adb5723..df117f35d4 100644
--- a/block/file-posix.c
+++ b/block/file-posix.c
@@ -4362,12 +4362,20 @@ hdev_co_ioctl(BlockDriverState *bs, unsigned long int req, void *buf)
return ret;
}
- if (req == SG_IO && s->pr_mgr) {
+ if (req == SG_IO) {
struct sg_io_hdr *io_hdr = buf;
- if (io_hdr->cmdp[0] == PERSISTENT_RESERVE_OUT ||
- io_hdr->cmdp[0] == PERSISTENT_RESERVE_IN) {
- return pr_manager_execute(s->pr_mgr, qemu_get_current_aio_context(),
- s->fd, io_hdr);
+
+ if (s->pr_mgr) {
+ if (io_hdr->cmdp[0] == PERSISTENT_RESERVE_OUT ||
+ io_hdr->cmdp[0] == PERSISTENT_RESERVE_IN ||
+ io_hdr->cmdp[0] == PR_HELPER_CLEANUP) {
+ return pr_manager_execute(s->pr_mgr, qemu_get_current_aio_context(),
+ s->fd, io_hdr);
+ }
+ } else if (io_hdr->cmdp[0] == PR_HELPER_CLEANUP) {
+ /* This is a nop without pr-manager */
+ io_hdr->status = GOOD;
+ return 0;
}
}