- kvm-virtio-net-disable-USO-for-virt-rhel9.6.patch [RHEL-80313] - kvm-arm-Use-arm_virt_compat_set-to-apply-the-compat.patch [RHEL-80313] - kvm-file-posix-probe-discard-alignment-on-Linux-block-de.patch [RHEL-86032] - kvm-block-io-skip-head-tail-requests-on-EINVAL.patch [RHEL-86032] - kvm-file-posix-Fix-crash-on-discard_granularity-0.patch [RHEL-86032] - Resolves: RHEL-80313 (Unable to migrate VM from RHEL10.0/qemu-kvm-9.6 to RHEL9.6/qemu-kvm-9.6) - Resolves: RHEL-86032 (QEMU sends unaligned discards on 4K devices [RHEL-9.7])
47 lines
1.8 KiB
Diff
47 lines
1.8 KiB
Diff
From 3515c6541f71817727a3a8b18ec5252644b51bc0 Mon Sep 17 00:00:00 2001
|
|
From: Kevin Wolf <kwolf@redhat.com>
|
|
Date: Tue, 29 Apr 2025 17:56:54 +0200
|
|
Subject: [PATCH 5/5] file-posix: Fix crash on discard_granularity == 0
|
|
|
|
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
|
|
RH-MergeRequest: 355: file-posix: probe discard alignment on Linux block devices
|
|
RH-Jira: RHEL-86032
|
|
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
|
RH-Commit: [3/3] b8139a4c5b19efff1f15c314447a6abb89db0ae7 (stefanha/centos-stream-qemu-kvm)
|
|
|
|
Block devices that don't support discard have a discard_granularity of
|
|
0. Currently, this results in a division by zero when we try to make
|
|
sure that it's a multiple of request_alignment. Only try to update
|
|
bs->bl.pdiscard_alignment when we got a non-zero discard_granularity
|
|
from sysfs.
|
|
|
|
Fixes: f605796aae4 ('file-posix: probe discard alignment on Linux block devices')
|
|
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
|
|
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
Reviewed-by: Eric Blake <eblake@redhat.com>
|
|
Message-ID: <20250429155654.102735-1-kwolf@redhat.com>
|
|
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
(cherry picked from commit 71a30d54e6ab1d5c102a8bee2c263414697402ea)
|
|
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
---
|
|
block/file-posix.c | 2 +-
|
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
|
diff --git a/block/file-posix.c b/block/file-posix.c
|
|
index 3d5b024459..0cb4e922c0 100644
|
|
--- a/block/file-posix.c
|
|
+++ b/block/file-posix.c
|
|
@@ -1565,7 +1565,7 @@ static void raw_refresh_limits(BlockDriverState *bs, Error **errp)
|
|
int ret;
|
|
|
|
ret = hdev_get_pdiscard_alignment(&st, &dalign);
|
|
- if (ret == 0) {
|
|
+ if (ret == 0 && dalign != 0) {
|
|
uint32_t ralign = bs->bl.request_alignment;
|
|
|
|
/* Probably never happens, but handle it just in case */
|
|
--
|
|
2.48.1
|
|
|