[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/18] block/gluster: correctly set max_pdiscard
From: |
Kevin Wolf |
Subject: |
[PULL 16/18] block/gluster: correctly set max_pdiscard |
Date: |
Thu, 9 Jun 2022 19:21:47 +0200 |
From: Fabian Ebner <f.ebner@proxmox.com>
On 64-bit platforms, assigning SIZE_MAX to the int64_t max_pdiscard
results in a negative value, and the following assertion would trigger
down the line (it's not the same max_pdiscard, but computed from the
other one):
qemu-system-x86_64: ../block/io.c:3166: bdrv_co_pdiscard: Assertion
`max_pdiscard >= bs->bl.request_alignment' failed.
On 32-bit platforms, it's fine to keep using SIZE_MAX.
The assertion in qemu_gluster_co_pdiscard() is checking that the value
of 'bytes' can safely be passed to glfs_discard_async(), which takes a
size_t for the argument in question, so it is kept as is. And since
max_pdiscard is still <= SIZE_MAX, relying on max_pdiscard is still
fine.
Fixes: 0c8022876f ("block: use int64_t instead of int in driver discard
handlers")
Cc: qemu-stable@nongnu.org
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
Message-Id: <20220520075922.43972-1-f.ebner@proxmox.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
block/gluster.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/block/gluster.c b/block/gluster.c
index 398976bc66..b60213ab80 100644
--- a/block/gluster.c
+++ b/block/gluster.c
@@ -891,7 +891,7 @@ out:
static void qemu_gluster_refresh_limits(BlockDriverState *bs, Error **errp)
{
bs->bl.max_transfer = GLUSTER_MAX_TRANSFER;
- bs->bl.max_pdiscard = SIZE_MAX;
+ bs->bl.max_pdiscard = MIN(SIZE_MAX, INT64_MAX);
}
static int qemu_gluster_reopen_prepare(BDRVReopenState *state,
--
2.35.3
- [PULL 00/18] Block layer patches, Kevin Wolf, 2022/06/09
- [PULL 09/18] linux-headers: Add vduse.h, Kevin Wolf, 2022/06/09
- [PULL 04/18] block: improve block_dirty_bitmap_merge(): don't allocate extra bitmap, Kevin Wolf, 2022/06/09
- [PULL 12/18] vduse-blk: Add vduse-blk resize support, Kevin Wolf, 2022/06/09
- [PULL 06/18] block: Support passing NULL ops to blk_set_dev_ops(), Kevin Wolf, 2022/06/09
- [PULL 17/18] aio_wait_kick: add missing memory barrier, Kevin Wolf, 2022/06/09
- [PULL 05/18] block: simplify handling of try to merge different sized bitmaps, Kevin Wolf, 2022/06/09
- [PULL 11/18] vduse-blk: Implement vduse-blk export, Kevin Wolf, 2022/06/09
- [PULL 16/18] block/gluster: correctly set max_pdiscard,
Kevin Wolf <=
- [PULL 01/18] block: drop unused bdrv_co_drain() API, Kevin Wolf, 2022/06/09
- [PULL 10/18] libvduse: Add VDUSE (vDPA Device in Userspace) library, Kevin Wolf, 2022/06/09
- [PULL 14/18] qsd: document vduse-blk exports, Kevin Wolf, 2022/06/09
- [PULL 15/18] block/rbd: report a better error when namespace does not exist, Kevin Wolf, 2022/06/09
- [PULL 08/18] block/export: Abstract out the logic of virtio-blk I/O process, Kevin Wolf, 2022/06/09
- [PULL 13/18] libvduse: Add support for reconnecting, Kevin Wolf, 2022/06/09
- [PULL 03/18] block: block_dirty_bitmap_merge(): fix error path, Kevin Wolf, 2022/06/09
- [PULL 07/18] block/export: Fix incorrect length passed to vu_queue_push(), Kevin Wolf, 2022/06/09
- [PULL 18/18] nbd: Drop dead code spotted by Coverity, Kevin Wolf, 2022/06/09
- [PULL 02/18] block: get rid of blk->guest_block_size, Kevin Wolf, 2022/06/09