* [PULL 0/1] Block patches
@ 2025-04-30 15:47 Stefan Hajnoczi
2025-04-30 15:47 ` [PULL 1/1] file-posix: Fix crash on discard_granularity == 0 Stefan Hajnoczi
2025-04-30 19:04 ` [PULL 0/1] Block patches Stefan Hajnoczi
0 siblings, 2 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2025-04-30 15:47 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-block, Hanna Czenczek, Kevin Wolf, Stefan Hajnoczi
The following changes since commit 73d29ea2417b58ca55fba1aa468ba38e3607b583:
Merge tag 'for-upstream' of https://repo.or.cz/qemu/kevin into staging (2025-04-27 12:47:23 -0400)
are available in the Git repository at:
https://gitlab.com/stefanha/qemu.git tags/block-pull-request
for you to fetch changes up to 71a30d54e6ab1d5c102a8bee2c263414697402ea:
file-posix: Fix crash on discard_granularity == 0 (2025-04-30 11:40:05 -0400)
----------------------------------------------------------------
Pull request
Kevin's fix for the divide-by-zero in my recent discard commit, triggered when
a host block device does not support discard.
----------------------------------------------------------------
Kevin Wolf (1):
file-posix: Fix crash on discard_granularity == 0
block/file-posix.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--
2.49.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PULL 1/1] file-posix: Fix crash on discard_granularity == 0
2025-04-30 15:47 [PULL 0/1] Block patches Stefan Hajnoczi
@ 2025-04-30 15:47 ` Stefan Hajnoczi
2025-04-30 19:04 ` [PULL 0/1] Block patches Stefan Hajnoczi
1 sibling, 0 replies; 4+ messages in thread
From: Stefan Hajnoczi @ 2025-04-30 15:47 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-block, Hanna Czenczek, Kevin Wolf, Stefan Hajnoczi,
Eric Blake
From: Kevin Wolf <kwolf@redhat.com>
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>
---
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.49.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PULL 0/1] Block patches
2025-04-30 15:47 [PULL 0/1] Block patches Stefan Hajnoczi
2025-04-30 15:47 ` [PULL 1/1] file-posix: Fix crash on discard_granularity == 0 Stefan Hajnoczi
@ 2025-04-30 19:04 ` Stefan Hajnoczi
2025-05-01 13:03 ` Peter Maydell
1 sibling, 1 reply; 4+ messages in thread
From: Stefan Hajnoczi @ 2025-04-30 19:04 UTC (permalink / raw)
To: Stefan Hajnoczi
Cc: qemu-devel, qemu-block, Hanna Czenczek, Kevin Wolf,
Stefan Hajnoczi
[-- Attachment #1: Type: text/plain, Size: 116 bytes --]
Applied, thanks.
Please update the changelog at https://wiki.qemu.org/ChangeLog/10.0 for any user-visible changes.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-05-01 13:04 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-30 15:47 [PULL 0/1] Block patches Stefan Hajnoczi
2025-04-30 15:47 ` [PULL 1/1] file-posix: Fix crash on discard_granularity == 0 Stefan Hajnoczi
2025-04-30 19:04 ` [PULL 0/1] Block patches Stefan Hajnoczi
2025-05-01 13:03 ` Peter Maydell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).