[Devel] [PATCH] Fix Issue: When VirtIO Backend providing VIRTIO_BLK_F_MQ feature, The file system of the front-end OS fails to be mounted.

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jun 14 14:23:49 MSK 2024


Hi Lynch, Andrey,

thank you for the patch, but can you please describe the problem it fixes in a bit more details?
i see that the patch preserves original req->sector, but why/how that becomes important in case 
VIRTIO_BLK_F_MQ feature is set?

Thank you.

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 17.05.2024 11:09, Andrey Zhadchenko wrote:
> Hi
> 
> Thank you for the patch.
> vhost-blk didn't spark enough interest to be reviewed and merged into
> the upstream and the code is not present here.
> I have forwarded your patch to relevant openvz kernel mailing list.
> 
> On 5/17/24 07:34, Lynch wrote:
>> ---
>>    drivers/vhost/blk.c | 6 ++++--
>>    1 file changed, 4 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/vhost/blk.c b/drivers/vhost/blk.c
>> index 44fbf253e773..0e946d9dfc33 100644
>> --- a/drivers/vhost/blk.c
>> +++ b/drivers/vhost/blk.c
>> @@ -251,6 +251,7 @@ static int vhost_blk_bio_make(struct vhost_blk_req *req,
>>    	struct page **pages, *page;
>>    	struct bio *bio = NULL;
>>    	int bio_nr = 0;
>> +	sector_t sector_tmp;
>>    
>>    	if (unlikely(req->bi_opf == REQ_OP_FLUSH))
>>    		return vhost_blk_bio_make_simple(req, bdev);
>> @@ -270,6 +271,7 @@ static int vhost_blk_bio_make(struct vhost_blk_req *req,
>>    		req->bio = req->inline_bio;
>>    	}
>>    
>> +	sector_tmp = req->sector;
>>    	req->iov_nr = 0;
>>    	for (i = 0; i < iov_nr; i++) {
>>    		int pages_nr = iov_num_pages(&iov[i]);
>> @@ -302,7 +304,7 @@ static int vhost_blk_bio_make(struct vhost_blk_req *req,
>>    				bio = bio_alloc(GFP_KERNEL, pages_nr_total);
>>    				if (!bio)
>>    					goto fail;
>> -				bio->bi_iter.bi_sector  = req->sector;
>> +				bio->bi_iter.bi_sector  = sector_tmp;
>>    				bio_set_dev(bio, bdev);
>>    				bio->bi_private = req;
>>    				bio->bi_end_io  = vhost_blk_req_done;
>> @@ -314,7 +316,7 @@ static int vhost_blk_bio_make(struct vhost_blk_req *req,
>>    			iov_len		-= len;
>>    
>>    			pos = (iov_base & VHOST_BLK_SECTOR_MASK) + iov_len;
>> -			req->sector += pos >> VHOST_BLK_SECTOR_BITS;
>> +			sector_tmp += pos >> VHOST_BLK_SECTOR_BITS;
>>    		}
>>    
>>    		pages += pages_nr;


More information about the Devel mailing list