aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/target/target_core_iblock.c
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2012-09-07 11:30:41 -0400
committerNicholas Bellinger <nab@linux-iscsi.org>2012-09-17 20:13:38 -0400
commite0de44573637ba43e43ae1af042e109bbf2b6dd0 (patch)
tree177deae38b8bf505a749247b04a90b6b0b0c8eca /drivers/target/target_core_iblock.c
parenta50da144d048f9dbebed2b1441ed779d6bbbcd03 (diff)
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: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target/target_core_iblock.c')
-rw-r--r--drivers/target/target_core_iblock.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/target/target_core_iblock.c b/drivers/target/target_core_iblock.c
index 5b745bb56a68..29408d46a6d9 100644
--- a/drivers/target/target_core_iblock.c
+++ b/drivers/target/target_core_iblock.c
@@ -654,6 +654,12 @@ static int iblock_execute_rw(struct se_cmd *cmd)
654 goto fail; 654 goto fail;
655 cmd->priv = ibr; 655 cmd->priv = ibr;
656 656
657 if (!sgl_nents) {
658 atomic_set(&ibr->pending, 1);
659 iblock_complete_cmd(cmd);
660 return 0;
661 }
662
657 bio = iblock_get_bio(cmd, block_lba, sgl_nents); 663 bio = iblock_get_bio(cmd, block_lba, sgl_nents);
658 if (!bio) 664 if (!bio)
659 goto fail_free_ibr; 665 goto fail_free_ibr;