From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrey Zhadchenko Date: Mon, 24 Aug 2026 18:59:22 +0300 Subject: [Devel] [PATCH VZ10 v2 3/5] drivers/vhost/blk: fix flush support In-Reply-To: <20260824155924.235122-1-andrey.zhadchenko@virtuozzo.com> References: <20260824155924.235122-1-andrey.zhadchenko@virtuozzo.com> Message-ID: <20260824155924.235122-4-andrey.zhadchenko@virtuozzo.com> List-Id: REQ_OP_FLUSH is a technical flag for requests. For bios the correct combination would be REQ_OP_WRITE | REQ_PREFLUSH. See an example in blkdev_issue_flush(). https://virtuozzo.atlassian.net/browse/VSTOR-138640 Fixes: 40a5928ec730 ("drivers/vhost: vhost-blk accelerator for virtio-blk guests") Signed-off-by: Andrey Zhadchenko --- drivers/vhost/blk.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/vhost/blk.c b/drivers/vhost/blk.c index 2c41a073004bc..5c8d5b210c315 100644 --- a/drivers/vhost/blk.c +++ b/drivers/vhost/blk.c @@ -274,7 +274,7 @@ static int vhost_blk_bio_make(struct vhost_blk_req *req, sector_t sector = req->sector; unsigned long pos = 0; - if (unlikely(req->bi_opf == REQ_OP_FLUSH)) + if (unlikely(req->bi_opf & REQ_PREFLUSH)) return vhost_blk_bio_make_simple(req, bdev); if (req->bi_opf == REQ_OP_WRITE && req->len & SECTOR_MASK) { @@ -488,7 +488,7 @@ static int vhost_blk_req_handle(struct vhost_virtqueue *vq, ret = vhost_blk_req_submit(req); break; case VIRTIO_BLK_T_FLUSH: - req->bi_opf = REQ_OP_FLUSH; + req->bi_opf = REQ_OP_WRITE | REQ_PREFLUSH; ret = vhost_blk_req_submit(req); break; case VIRTIO_BLK_T_GET_ID: -- 2.43.5