提交 e0de4457 编写于 作者: P Paolo Bonzini 提交者: Nicholas Bellinger

target: do not submit a zero-bio I/O request

scsi_setup_fs_cmnd does not like to receive requests with no
bios attached to it.  Special-case zero-length reads and writes,
by not submitting any bio.

Testcase: sg_raw /dev/sdb 28 00 00 00 00 00 00 00 00 00
    should not fail
    panics with the rest of the series but not this patch
    behaves correctly without or with this series
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
Signed-off-by: NNicholas Bellinger <nab@linux-iscsi.org>
上级 a50da144
...@@ -654,6 +654,12 @@ static int iblock_execute_rw(struct se_cmd *cmd) ...@@ -654,6 +654,12 @@ static int iblock_execute_rw(struct se_cmd *cmd)
goto fail; goto fail;
cmd->priv = ibr; cmd->priv = ibr;
if (!sgl_nents) {
atomic_set(&ibr->pending, 1);
iblock_complete_cmd(cmd);
return 0;
}
bio = iblock_get_bio(cmd, block_lba, sgl_nents); bio = iblock_get_bio(cmd, block_lba, sgl_nents);
if (!bio) if (!bio)
goto fail_free_ibr; goto fail_free_ibr;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册