[SPDK] flush request error

Cao, Gang gang.cao at intel.com
Tue Oct 16 07:23:21 PDT 2018

Hi Honghui,

Could you just submit a patch for this?


-----Original Message-----
From: SPDK [mailto:spdk-bounces at lists.01.org] On Behalf Of wanghonghui
Sent: Tuesday, October 16, 2018 4:50 PM
To: spdk at lists.01.org
Subject: [SPDK] flush request error

hi all:
    I ran a kvm virtual machine(Linux), and this machine have a vhost spdk disk
    when I use mkfs.ext4 to create a filesystem on this disk, I got a error "blk_update_request: I/O error , dev vdb, sector 0"
    I test three kernel version :
    4.0, 4.1(from upstream compiled by myself)
    3.10.0-693(from centos7)

    only 4.0 and 4.1 have this problem, 3.10.0-693 is ok   


    The reason is mkfs.ext4 issue some flush requests to vhost spdk disk, but spdk's process_blk_request function do not issue the VIRTIO_BLK_T_FLUSH requests to bdev
    so I modify the process_blk_request function and the problem resolved:

    diff --git a/lib/vhost/vhost_blk.c b/lib/vhost/vhost_blk.c
    index 9e986d4..ee3c8a8 100644
    --- a/lib/vhost/vhost_blk.c
    +++ b/lib/vhost/vhost_blk.c
    @@ -269,6 +269,14 @@ process_blk_request(struct spdk_vhost_blk_task *task, struct spdk_vhost_blk_dev
                                task->used_len, ' ');
                blk_request_finish(true, task);
   +       case VIRTIO_BLK_T_FLUSH:
   +               task->used_len = payload_len + sizeof(*task->status);
   +               rc = spdk_bdev_flush(bvdev->bdev_desc, bvdev->bdev_io_channel, 0, 0, blk_request_complete_cb, task);
   +               if (rc) {
   +                       invalid_blk_request(task, VIRTIO_BLK_S_IOERR);
   +                       return -1;
   +               }
   +               break; 



SPDK mailing list
SPDK at lists.01.org

More information about the SPDK mailing list