History | View | Annotate | Download (42.6 kB)
block/iscsi: fix segfault if writesame fails
commit fa6252b0 introduced a segfault because it triesto read iTask.task->sense after iTask.task has beenfreed.
Signed-off-by: Peter Lieven <pl@kamp.de>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
block/iscsi: fix deadlock on scsi check condition
the retry logic was broken because the complete statusof the task structure was not reset. this resulted inan infinite loop retrying the command over and over.
CC: qemu-stable@nongnu.orgSigned-off-by: Peter Lieven <pl@kamp.de>...
block/iscsi: query for supported VPD pages
this patch ensures that we only query for block provisioning andblock limits vpd pages if they are advertised. It also cleansup the inquiry code and eliminates some redundant code.
Signed-off-by: Peter Lieven <pl@kamp.de>...
iscsi: fix indentation
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Reviewed-by: Fam Zheng <famz@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
iscsi: correctly propagate errors in iscsi_open
Before: $ ./qemu-io-old qemu-io-old> open -r -o file.driver=iscsi,file.filename=foo Failed to parse URL : foo qemu-io-old: can't open device (null): Could not open 'foo': Invalid argument
After:...
Merge remote-tracking branch 'remotes/qmp-unstable/queue/qmp' into staging
Use error_is_set() only when necessary
error_is_set(&var) is the same as var != NULL, but it takeswhole-program analysis to figure that out. Unnecessarily hard foroptimizers, static checkers, and human readers. Dumb it down toobvious.
Gets rid of several dozen Coverity false positives....
block: Add notes to iSCSI's .bdrv_open and .bdrv_reopen_prepare
iSCSI currently does not need to do any actions to support thecurrent usage of bdrv_reopen(). However, it is important to notea couple of things: 1.) A connection will not be re-established to...
block/iscsi: always fill bs->bl.opt_transfer_length
the opt_transfer_length has nothing to do with logicalblock provisioning stuff so always copy it fromthe block limits VPD page.
Reported-By: Benoit Canet <benoit@irqsave.net>Signed-off-by: Peter Lieven <pl@kamp.de>...
Merge remote-tracking branch 'bonzini/scsi-next' into staging
iscsi: Set bs->request_alignment
The iSCSI backend already gets the block size from the READ CAPACITYcommand it sends. Save it so that the generic block layer gets ittoo.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
block: Move initialisation of BlockLimits to bdrv_refresh_limits()
This function separates filling the BlockLimits from bdrv_open(), whichallows it to call it from other operations which may change the limits(e.g. modifications to the backing file chain or bdrv_reopen)...
block/iscsi: return -ENOMEM if an async call fails immediately
if an async libiscsi call fails directly it can only be dueto an out of memory condition. All other errors are returnedthrough the callback.
Signed-off-by: Peter Lieven <pl@kamp.de>Reviewed-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>...
block: add .bdrv_reopen_prepare() stub for iscsi
To suppport reopen(), the .bdrv_reopen_prepare() stub must exist.iSCSI does not have anything that needs to be done to support reopen,so we can just implement the _prepare() stub.
Signed-off-by: Jeff Cody <jcody@redhat.com>...
Merge remote branch 'luiz/queue/qmp' into qmpq
Message-id: 1387720926-11421-1-git-send-email-pbonzini@redhat.com...
qemu-option: Remove qemu_opts_create_nofail
This is a boiler-plate _nofail variant of qemu_opts_create. Remove anduse error_abort in call sites.
null/0 arguments needs to be added for the id and fail_if_exists fieldsin affected callsites due to argument inconsistency between the normal and...
block/iscsi: Fix compilation for libiscsi 1.4.0 (API change)
Function iscsi_read10_task got additional parameters starting with versionlibiscsi 1.5.0.
libiscsi 1.4.0 is still widely used (Debian wheezy, jessie and other Linuxdistributions currently provide packages for QEMU which use it), so we...
block/iscsi: use a bh to schedule co reentrance
this fixes a potential segfault and performance regression.
If the coroutine is reentered directly in the iscsi_co_generic_cbiscsi_process_{read,write} are interrupted and reentered anytime later. One the one hand this could happen after an iscsi_close...
block/iscsi: introduce bdrv_co_{readv, writev, flush_to_disk}
this converts read, write and flush functions from aio to coroutineseliminating almost 200 lines of code.
The requirement for libiscsi is bumped to version 1.4.0 which wasreleased in may 2012....
block/iscsi: set bdi->cluster_size
this patch aims to set bdi->cluster_size to the internal page sizeof the iscsi target so that enabled callers can align requestsproperly.
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Peter Lieven <pl@kamp.de>...
block/iscsi: set bs->bl.opt_transfer_length
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Peter Lieven <pl@kamp.de>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/iscsi: remove .bdrv_has_zero_init
since commit 3ac21627 the default value changed to 0.
Signed-off-by: Peter Lieven <pl@kamp.de>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/iscsi: updated copyright
added myself to reflect recent work on the iscsi block driver.
block/iscsi: check WRITE SAME support differently depending on MAY_UNMAP
The current check is right for MAY_UNMAP=1. For MAY_UNMAP=0, justtry and fall back to regular writes as soon as a WRITE SAME commandfails.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>...
iscsi: set limits in BlockDriverState
Reviewed-by: Eric Blake <eblake@redhat.com>Signed-off-by: Peter Lieven <pl@kamp.de>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
iscsi: simplify iscsi_co_discard
now that bdrv_co_discard can handle limits we do not needthe request split logic here anymore.
iscsi: add bdrv_co_write_zeroes
Signed-off-by: Peter Lieven <pl@kamp.de>Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block/iscsi: add .bdrv_get_info
misc: New spelling fixes in comments
compatiblity -> compatibilitycontinously -> continuouslyexistance -> existenceusefull -> usefulshoudl -> should
Signed-off-by: Stefan Weil <sw@weilnetz.de>Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
block/iscsi: reenable iscsi_co_get_block_status
Commit f35c934a accidently disabled iscsi_co_get_block_status for alllibiscsi versions. Its not possible to check for enumeration constantsin the C preprocessor. This patch changes the check to the preprocessor...
block: introduce BlockDriver.bdrv_needs_filename to enable some drivers.
Some drivers will have driver specifics options but no filename.This new bool allow the block layer to treat them correctly.
The .bdrv_needs_filename is set in drivers not having .bdrv_parse_filename and...
block/iscsi: Drop iscsi_co_get_block_status for older versions of libiscsi
Debian wheezy includes libiscsi-dev 1.4.0 which does not provideSCSI_PROVISIONING_TYPE_DEALLOCATED. Drop iscsi_co_get_block_statusin this case to allow compilation without errors....
Merge remote-tracking branch 'kwolf/for-anthony' into staging
iscsi: split discard requests in multiple parts
Replace .bdrv_aio_discard with .bdrv_co_discard so that discardrequests can be split in multiple parts, each for a small amountof sectors.
This is useful because we expose a generic API with no limiton the amount of sectors that can be unmapped in one request....
bdrv: Use "Error" for creating images
Add an Error ** parameter to BlockDriver.bdrv_create to allow morespecific error messages.
Signed-off-by: Max Reitz <mreitz@redhat.com>
bdrv: Use "Error" for opening images
Add an Error ** parameter to BlockDriver.bdrv_open andBlockDriver.bdrv_file_open to allow more specific error messages.
scsi: prefer UUID to VM name for the initiator name
The UUID is unique even across multiple hosts, thus it isbetter than a VM name even if it is less user-friendly.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
iscsi: add logical block provisioning information to iscsilun
iscsi: add .bdrv_get_block_status
this patch adds a coroutine for .bdrv_co_block_status as well asa generic framework that can be used to build coroutines in block/iscsi.
iscsi: use bdrv_new() instead of stack structure
BlockDriverState structure needs bdrv_new() to initialize refcnt, don'tallocate a local structure variable and memset to 0, becasue with comingrefcnt implementation, bdrv_unref will crash if bs->refcnt not...
block: make bdrv_delete() static
Manage BlockDriverState lifecycle with refcnt, so bdrv_delete() is nolonger public and should be called by bdrv_unref() if refcnt isdecreased to 0.
This is an identical change because effectively, there's no multiplereference of BDS now: no caller of bdrv_ref() yet, only bdrv_new() sets...
aio / timers: Switch entire codebase to the new timer API
This is an autogenerated patch using scripts/switch-timer-api.
Switch the entire code base to using the new timer API.
Note this patch may introduce some line length issues.
Signed-off-by: Alex Bligh <alex@alex.org.uk>...
block/iscsi: drop iscsi_process_flush()
.io_flush() is no longer called so drop iscsi_process_flush().
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
aio: drop io_flush argument
The .io_flush() handler no longer exists and has no users. Drop theio_flush argument to aio_set_fd_handler() and related functions.
The AioFlushEventNotifierHandler and AioFlushHandler typedefs are nolonger used and are dropped too....
block/iscsi.c: Fix printf format error.
The error on armv7hl was:
block/iscsi.c: In function ‘is_request_lun_aligned’:block/iscsi.c:251:26: error: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘int64_t’ [-Werror=format=] iscsilun->block_size, sector_num, nb_sectors);...
iscsi: remove support for misaligned nb_sectors in aio_readv
this hask is not working (anymore). support for misaligned offsets shouldbe handled at the block layer.
Signed-off-by: Peter Lieven <pl@kamp.de>Cc: qemu-stable@nongnu.orgSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>
iscsi: assert that sectors are aligned to LUN blocksize
if the blocksize of an iSCSI LUN is bigger than the BDRV_SECTOR_SIZEit is possible that sector_num or nb_sectors are not correctlyaligned.
to avoid corruption we fail requests which are misaligned....
iscsi: factor out sector conversions
Reviewed-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Peter Lieven <pl@kamp.de>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
iscsi: fix -ENOSPC in iscsi_create()
the -ENOPSC case did not work due to the missing goto.
Reported-by: Kevin Wolf <kwolf@redhat.com>Signed-off-by: Peter Lieven <pl@kamp.de>Cc: qemu-stable@nongnu.orgSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>
Fix iSCSI crash on SG_IO with an iovector
Don't assume that SG_IO is always invoked with a simple buffer,check the iovec_count and if it is >= 1 then we need to pass an arrayof iovectors to libiscsi instead of just a plain buffer.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>...
iscsi: simplify freeing of tasks
Always free them in the iscsi_aio_*_acb functions and remove thechecks in their callers. Remove ifs when the task struct waspreviously dereferenced (spotted by Coverity).
Cc: qemu-stable@nongnu.orgSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>
iscsi: reorganize iscsi_readcapacity_sync
Avoid the goto, and use the same retry logic for the 10- and 16-byte versions.
block: Remove filename parameter from .bdrv_file_open()
It is unused now in all block drivers.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>Reviewed-by: Eric Blake <eblake@redhat.com>
iscsi: Use bdrv_open options instead of filename
This is only to convert the internal interface that is used for passingthe "filename" to be parsed, but converting to actual fine grainedoptions is left for another day, as it doesn't look trivial.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>...
hw: move headers to include/
Many of these should be cleaned up with proper qdev-/QOM-ification.Right now there are many catch-all headers in include/hw/ARCH dependingon cpu.h, and this makes it necessary to compile these files per-target.However, fixing this does not belong in these patches....
block: Add options QDict to bdrv_file_open() prototypes
The new parameter is unused yet.
iscsi: add iscsi_truncate support
this patch adds iscsi_truncate which effectively allows foronline resizing of iscsi volumes. for this to work you haveto resize the volume on your storage and then callblock_resize command in qemu which will issue areadcapacity16 to update the capacity....
iscsi: retry read, write, flush and unmap on unit attention check conditions
the storage might return a check condition status for various reasons.(e.g. bus reset, capacity change, thin-provisioning info etc.)
currently all these informative status responses lead to an I/O error...
iscsi: do not leak acb->buf when commands are aborted
acb->buf is freed in the WRITE callback, but this may notget called at all when commands are aborted. Add anotherfree in the ABORT TASK callback, which requires setting acb->bufto NULL everywhere....
iscsi: add support for iovectors
This patch adds support for directly passing the iovecarray from QEMUIOVector if libiscsi supports it (1.8.0or newer).
Signed-off-by: Peter Lieven <pl@kamp.de>[Preserve the improvements from commit 4cc841b, iscsi: partly...
iscsi: add iscsi_create support
This patch adds support for bdrv_create. This allows e.g.to use qemu-img to convert from any supported device toan iscsi backed storage as destination.
iscsi: partly avoid iovec linearization in iscsi_aio_writev
libiscsi expects all write16 data in a linear buffer. If theiovec only contains one buffer we can skip the linearizationstep as well as the additional malloc/free and pass thebuffer directly....
iscsi: add support for iSCSI NOPs [v2]
This patch will send NOP-Out PDUs every 5 seconds to the iSCSI target.If a consecutive number of NOP-In replies fail a reconnect is initiated.iSCSI NOPs help to ensure that the connection to the target is still operational....
qemu-option: move standard option definitions out of qemu-config.c
misc: move include files to include/qemu/
block: move include files to include/block/
janitor: do not rely on indirect inclusions of or from qemu-char.h
Various header files rely on qemu-char.h including qemu-config.h ormain-loop.h, but they really do not need qemu-char.h at all (particularlyinteresting is the case of the block layer!). Clean this up, and also...
iscsi: do not assume device is zero initialized
Without any complex checks we can't assume that aniscsi target is initialized to zero.
iscsi: fix deadlock during login
If the connection is interrupted before the first login is successfullycompleted qemu-kvm is waiting forever in qemu_aio_wait().
This is fixed by performing an sync login to the target. If theconnection breaks after the first successful login errors are...
iscsi: fix segfault in url parsing
If an invalid URL is specified iscsi_get_error(iscsi) is calledwith iscsi == NULL.
aio: rename AIOPool to AIOCBInfo
Now that AIOPool no longer keeps a freelist, it isn't really a "pool" anymore. Rename it to AIOCBInfo and make it const since it no longerneeds to be modified.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
block: do not parse BDRV_O_CACHE_WB in block drivers
Block drivers should ignore BDRV_O_CACHE_WB in .bdrv_open flags,and in the bs->open_flags.
This patch removes the code, leaving the behaviour behind as ifBDRV_O_CACHE_WB was set.
iSCSI: We dont need to explicitely call qemu_notify_event() any more
We no longer need to explicitely call qemu_notify_event() any moresince this is now done automatically any time the filehandles we listento change.
iSCSI: We need to support SG_IO also from iscsi_ioctl()
We need to support SG_IO from the synchronous iscsi_ioctl() sincescsi-block uses this to do an INQ to the device to discover its propertiesThis patch makes scsi-block work with iscsi.
iscsi: Set number of blocks to 0 for blank CDROM devices
The number of blocks of the device is used to compute the device sizein bdrv_getlength()/iscsi_getlength().For MMC devices, the ReturnedLogicalBlockAddress in the READCAPACITY10has a special meaning when it is 0....
iscsi: move iscsi_schedule_bh and iscsi_readv_writev_bh_cb
Put these functions at the beginning, to avoid forward referencesin the next patches.
iscsi: simplify iscsi_schedule_bh
It is always used with the same callback, remove the argument. Andits return value is never used, assume allocation succeeds.
iscsi: fix races between task completion and abort
This patch fixes two main issues with block/iscsi.c:
1) iscsi_task_mgmt_abort_task_async calls iscsi_scsi_task_cancel whichwas also directly called in iscsi_aio_cancel
2) a race between task completion and task abortion could happen cause...
Revert "iscsi: Fix NULL dereferences / races between task completion and abort"
This reverts commit 64e69e80920d82df3fa679bc41b13770d2f99360. The commitreturned immediately from iscsi_aio_cancel, risking corruption in case thefollowing happens:
guest qemu target...
iscsi: Fix NULL dereferences / races between task completion and abort
Signed-off-by: Stefan Priebe <s.priebe@profihost.ag>Acked-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
iscsi: Pick default initiator-name based on the name of the VM
This patch updates the iscsi layer to automatically pick a 'unique'initiator-name based on the name of the vm in case the user has not setan explicit iqn-name to use.
Create a new function qemu_get_vm_name() that returns the name of the VM,...
iscsi: do not leak initiator_name
The argument of iscsi_create_context is never freed by libiscsi,which in fact calls strdup on it. Avoid a leak.
iscsi: reorganize code for parse_initiator_name
Merge the occurrences of the "iqn.2008-11.org.linux-kvm" stringto avoid duplication.
Merge remote-tracking branch 'mjt/mjt-iov2' into staging
ISCSI: Add SCSI passthrough via scsi-generic to libiscsi
Update iscsi to allow passthrough of SG_IO scsi commands when the iscsidevice is forced to be scsi-generic.
Implement both bdrv_ioctl() and bdrv_aio_ioctl() in the iscsi backend,emulate the SG_IO ioctl and pass the SCSI commands across to the...
ISCSI: force use of sg for SMC and SSC devices
If the device we open is a SMC or SSC device, then force the use of sg. Wedont have any medium changer or tape emulation so only passthrough viareal sg or scsi-generic via iscsi would work anyway.
Forcing sg also makes qemu skip trying to read from the device to guess...
change qemu_iovec_to_buf() to match other to,from_buf functions
It now allows specifying offset within qiov to start from andamount of bytes to copy. Actual implementation is just a callto iov_to_buf().
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
ISCSI: Switch to using READ16/WRITE16 for I/O to the LUN
This allows using LUNs bigger than 2TB. Keep using READ10 for otherdevice types such as MMC.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
ISCSI: Only call READCAPACITY16 for SBC devices, use READCAPACITY10 for MMC
ISCSI: change num_blocks to 64-bit
ISCSI: get device type at connection time
This is needed to avoid READ CAPACITY for MMC devices.
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
ISCSI: redo how we set up the events
Call qemu_notify_event() after updating events. Otherwise, If we addan event for -is-writeable but the socket is already writeable theremay be a delay before the event callback is actually triggered.
Those delays would in particular hurt performance during BIOS boot and...
ISCSI: Add support for thin-provisioning via discard/UNMAP and bigger LUNs
Update the configure test for libiscsi support to detect version 1.3or later. Version 1.3 of libiscsi provides both READCAPACITY16 as wellas UNMAP commands.
Update the iscsi block layer to use READCAPACITY16 to detect the size of...
aio: remove process_queue callback and qemu_aio_process_queue
Both unused after the previous patch.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>Signed-off-by: Kevin Wolf <kwolf@redhat.com>
iSCSI: add configuration variables for iSCSI
This patch adds configuration variables for iSCSI to setinitiator-name to use when logging in to the target,which type of header-digest to negotiate with the targetand username and password for CHAP authentication....
iSCSI block driver
This provides built-in support for iSCSI to QEMU.
This has the advantage that the iSCSI devices need not be made visible to the host, which is useful if you have very many virtual machines and very many iscsi devices.It also has the benefit that non-root users of QEMU can access iSCSI devices across the network without requiring root privilege on the host....