Content-Type: multipart/mixed; boundary="===============0637950268719835779==" MIME-Version: 1.0 From: wanghonghui Subject: [SPDK] flush request error Date: Tue, 16 Oct 2018 16:49:43 +0800 Message-ID: <3de46fe8.fb40.1667c110bc9.Coremail.wanghonghui@ucloud.cn> List-ID: To: spdk@lists.01.org --===============0637950268719835779== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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, b= ut 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 *ta= sk, struct spdk_vhost_blk_dev task->used_len, ' '); blk_request_finish(true, task); break; + case VIRTIO_BLK_T_FLUSH: + task->used_len =3D payload_len + sizeof(*task->status); + rc =3D 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; = = = --===============0637950268719835779==--