- kvm-file-posix-probe-discard-alignment-on-Linux-block-de.patch [RHEL-87642] - kvm-block-io-skip-head-tail-requests-on-EINVAL.patch [RHEL-87642] - kvm-file-posix-Fix-crash-on-discard_granularity-0.patch [RHEL-87642] - kvm-Enable-vhost-user-gpu-pci-for-RHIVOS.patch [RHEL-86056] - Resolves: RHEL-87642 (QEMU sends unaligned discards on 4K devices[RHEL-10]) - Resolves: RHEL-86056 (Enable 'vhost-user-gpu-pci' in qemu-kvm for RHIVOS)
47 lines
1.8 KiB
Diff
47 lines
1.8 KiB
Diff
From 4d575970f12462a054a207b593438aff0d40881a Mon Sep 17 00:00:00 2001
|
|
From: Kevin Wolf <kwolf@redhat.com>
|
|
Date: Tue, 29 Apr 2025 17:56:54 +0200
|
|
Subject: [PATCH 3/4] file-posix: Fix crash on discard_granularity == 0
|
|
|
|
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
|
|
RH-MergeRequest: 354: file-posix: probe discard alignment on Linux block devices
|
|
RH-Jira: RHEL-87642
|
|
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
|
|
RH-Acked-by: Eric Blake <eblake@redhat.com>
|
|
RH-Commit: [3/3] dbe73aef453e77263d30ebebc690ab21145f6bab (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 0d6e12f880..0d85123d0f 100644
|
|
--- a/block/file-posix.c
|
|
+++ b/block/file-posix.c
|
|
@@ -1573,7 +1573,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.39.3
|
|
|