From 1cb6d137ffd380c458be2da24a58404708c0db55 Mon Sep 17 00:00:00 2001 From: Zhu Lingshan Date: Tue, 29 Dec 2015 11:32:14 +0800 Subject: iscsi: send readcapacity10 when readcapacity16 failed When play with Dell MD3000 target, for sure it is a TYPE_DISK, but readcapacity16 would fail. Then we find that readcapacity10 succeeded. It looks like the target just support readcapacity10 even through it is a TYPE_DISK or have some TYPE_ROM characteristics. This patch can give a chance to send readcapacity16 when readcapacity10 failed. This patch is not harmful to original pathes Signed-off-by: Zhu Lingshan Message-Id: <1451359934-9236-1-git-send-email-lszhu@suse.com> [Don't fall through on UNIT ATTENTION. - Paolo] Signed-off-by: Paolo Bonzini --- block/iscsi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'block') diff --git a/block/iscsi.c b/block/iscsi.c index eb28ddcac3..3acb052b1f 100644 --- a/block/iscsi.c +++ b/block/iscsi.c @@ -1243,8 +1243,13 @@ static void iscsi_readcapacity_sync(IscsiLun *iscsilun, Error **errp) iscsilun->lbprz = !!rc16->lbprz; iscsilun->use_16_for_rw = (rc16->returned_lba > 0xffffffff); } + break; } - break; + if (task != NULL && task->status == SCSI_STATUS_CHECK_CONDITION + && task->sense.key == SCSI_SENSE_UNIT_ATTENTION) { + break; + } + /* Fall through and try READ CAPACITY(10) instead. */ case TYPE_ROM: task = iscsi_readcapacity10_sync(iscsilun->iscsi, iscsilun->lun, 0, 0); if (task != NULL && task->status == SCSI_STATUS_GOOD) { -- cgit v1.2.3 From f1c17521e79df863a5771d96974fab0d07f02be0 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 7 Jan 2016 14:34:13 +0100 Subject: nbd-server: do not exit on failed memory allocation The amount of memory allocated in nbd_co_receive_request is driven by the NBD client (possibly a virtual machine). Parallel I/O can cause the server to allocate a large amount of memory; check for failures and return ENOMEM in that case. Cc: qemu-block@nongnu.org Reviewed-by: Max Reitz Signed-off-by: Paolo Bonzini --- block/block-backend.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'block') diff --git a/block/block-backend.c b/block/block-backend.c index f41d326b3c..e81375955f 100644 --- a/block/block-backend.c +++ b/block/block-backend.c @@ -1033,6 +1033,11 @@ void blk_set_guest_block_size(BlockBackend *blk, int align) blk->guest_block_size = align; } +void *blk_try_blockalign(BlockBackend *blk, size_t size) +{ + return qemu_try_blockalign(blk ? blk->bs : NULL, size); +} + void *blk_blockalign(BlockBackend *blk, size_t size) { return qemu_blockalign(blk ? blk->bs : NULL, size); -- cgit v1.2.3