summaryrefslogtreecommitdiff
path: root/block
AgeCommit message (Collapse)AuthorFilesLines
2014-06-10vdi: remove double conversionPaolo Bonzini1-1/+0
This should be a problem when running on big-endian machines. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Stefan Weil <sw@weilnetz.de> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-06-06sheepdog: reload only header in a case of live snapshotHitoshi Mitake1-3/+6
sheepdog driver doesn't need to read data_vdi_id[] when a live snapshot is created. Cc: Kevin Wolf <kwolf@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Cc: Liu Yuan <namei.unix@gmail.com> Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-06sheepdog: fix vdi object update after live snapshotHitoshi Mitake1-17/+23
sheepdog driver should decide a write request is COW or not based on inode object which is active when the write request is issued. Example of wrong inode update path in the previous driver: 1. drier issues an ordinal write request to an existing object 2. user creates a snapshot of the VDI before the write request is completed 3. the respones for the request is RDONLY, because the VDI is already a snapshot 4. the driver reload an inode object of the new active VDI, then issues a write request again 5. the second write request can be completed 6. driver decide the request is COW or not with the below conditional branch: if (s->inode.data_vdi_id[idx] != s->inode.vdi_id) { 7. the ID of the written object and VID of the new active VDI is different, so the driver updates data_vdi_id[idx] and writes inode object 8. the existing object cannot be seen by the new active VDI, it results object leaking Cc: Kevin Wolf <kwolf@redhat.com> Cc: Stefan Hajnoczi <stefanha@redhat.com> Cc: Liu Yuan <namei.unix@gmail.com> Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Hitoshi Mitake <mitake.hitoshi@lab.ntt.co.jp> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-06rbd: Fix leaks in rbd_start_aio() error pathKevin Wolf1-1/+4
Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Reviewed-by: Josh Durgin <josh.durgin@inktank.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-04raw-posix: drop raw_get_aio_fd() since it is no longer usedStefan Hajnoczi1-34/+0
virtio-blk data-plane now uses the QEMU block layer for I/O. We do not need raw_get_aio_fd() anymore. It was a layering violation anyway, so let's get rid of it. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-04vmdk: implement .bdrv_detach/attach_aio_context()Stefan Hajnoczi1-0/+23
Implement .bdrv_detach/attach_aio_context() interfaces to propagate detach/attach to BDRVVmdkState->extents[].file. The block layer takes care of ->file and ->backing_hd but doesn't know about our extents BlockDriverStates, which is also part of the graph. Reviewed-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-04ssh: use BlockDriverState's AioContextStefan Hajnoczi1-17/+19
Drop the assumption that we're using the main AioContext. Use bdrv_get_aio_context() to register fd handlers in the right AioContext for this BlockDriverState. The .bdrv_detach_aio_context() and .bdrv_attach_aio_context() interfaces are not needed since no fd handlers, timers, or BHs stay registered when requests have been drained. For now this doesn't make much difference but will allow ssh to work in IOThread instances in the future. Acked-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-04sheepdog: implement .bdrv_detach/attach_aio_context()Stefan Hajnoczi1-38/+80
Drop the assumption that we're using the main AioContext. Convert qemu_aio_set_fd_handler() to aio_set_fd_handler() and qemu_aio_wait() to aio_poll(). The .bdrv_detach/attach_aio_context() interfaces also need to be implemented to move the socket fd handler from the old to the new AioContext. Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Acked-by: Liu Yuan <namei.unix@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-04rbd: use BlockDriverState's AioContextStefan Hajnoczi1-2/+3
Drop the assumption that we're using the main AioContext. Convert qemu_bh_new() to aio_bh_new() and qemu_aio_wait() to aio_poll(). The .bdrv_detach_aio_context() and .bdrv_attach_aio_context() interfaces are not needed since no fd handlers, timers, or BHs stay registered when requests have been drained. Cc: Josh Durgin <josh.durgin@inktank.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Josh Durgin <josh.durgin@inktank.com>
2014-06-04block/raw-win32: implement .bdrv_detach/attach_aio_context()Stefan Hajnoczi3-4/+46
Drop the assumption that we're using the main AioContext for raw-win32. Convert the aio-win32 code to support detach/attach and replace qemu_aio_wait() with aio_poll(). The .bdrv_detach/attach_aio_context() interfaces move the aio-win32 event notifier from the old to the new AioContext. Cc: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-04block/raw-win32: create one QEMUWin32AIOState per BDRVRawStateStefan Hajnoczi3-13/+25
Each QEMUWin32AIOState event notifier is associated with an AioContext. Since BlockDriverState instances can use different AioContexts we cannot continue to use a global QEMUWin32AIOState. Let each BDRVRawState have its own QEMUWin32AIOState and free it when BDRVRawState is closed. Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-04block/linux-aio: fix memory and fd leakStefan Hajnoczi3-0/+14
Hot unplugging -drive aio=native,file=test.img,format=raw images leaves the Linux AIO event notifier and struct qemu_laio_state allocated. Luckily nothing will use the event notifier after the BlockDriverState has been closed so the handler function is never called. It's still worth fixing this resource leak. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-04block/raw-posix: implement .bdrv_detach/attach_aio_context()Stefan Hajnoczi3-2/+59
Drop the assumption that we're using the main AioContext for Linux AIO. Convert the Linux AIO event notifier to use aio_set_event_notifier(). The .bdrv_detach/attach_aio_context() interfaces also need to be implemented to move the event notifier handler from the old to the new AioContext. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-04quorum: implement .bdrv_detach/attach_aio_context()Stefan Hajnoczi1-12/+36
Implement .bdrv_detach/attach_aio_context() interfaces to propagate detach/attach to BDRVQuorumState->bs[] children. The block layer takes care of ->file and ->backing_hd but doesn't know about our ->bs[] BlockDriverStates, which is also part of the graph. Reviewed-by: BenoƮt Canet <benoit.canet@irqsave.net> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-04qed: use BlockDriverState's AioContextStefan Hajnoczi2-10/+33
Drop the assumption that we're using the main AioContext. Convert qemu_bh_new() to aio_bh_new() and qemu_aio_wait() to aio_poll() so we're using the BlockDriverState's AioContext. Implement .bdrv_detach/attach_aio_context() interfaces to move the QED_F_NEED_CHECK timer from the old AioContext to the new one. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-04nfs: implement .bdrv_detach/attach_aio_context()Stefan Hajnoczi1-24/+57
Drop the assumption that we're using the main AioContext. The following functions need to be converted: * qemu_bh_new() -> aio_bh_new() * qemu_aio_set_fd_handler() -> aio_set_fd_handler() * qemu_aio_wait() -> aio_poll() The .bdrv_detach/attach_aio_context() interfaces also need to be implemented to move the fd handler from the old to the new AioContext. Cc: Peter Lieven <pl@kamp.de> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de>
2014-06-04nbd: implement .bdrv_detach/attach_aio_context()Stefan Hajnoczi3-37/+78
Drop the assumption that we're using the main AioContext. Convert qemu_aio_set_fd_handler() calls to aio_set_fd_handler(). The .bdrv_detach/attach_aio_context() interfaces also need to be implemented to move the socket fd handler from the old to the new AioContext. Acked-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-04iscsi: implement .bdrv_detach/attach_aio_context()Stefan Hajnoczi1-24/+56
Drop the assumption that we're using the main AioContext for Linux AIO. Convert qemu_aio_set_fd_handler() to aio_set_fd_handler() and timer_new_ms() to aio_timer_new(). The .bdrv_detach/attach_aio_context() interfaces also need to be implemented to move the fd and timer from the old to the new AioContext. Cc: Peter Lieven <pl@kamp.de> Cc: Ronnie Sahlberg <ronniesahlberg@gmail.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Peter Lieven <pl@kamp.de>
2014-06-04gluster: use BlockDriverState's AioContextStefan Hajnoczi1-1/+6
Drop the assumption that we're using the main AioContext. Use aio_bh_new() instead of qemu_bh_new(). The .bdrv_detach_aio_context() and .bdrv_attach_aio_context() interfaces are not needed since no fd handlers, timers, or BHs stay registered when requests have been drained. Cc: Bharata B Rao <bharata@linux.vnet.ibm.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-04curl: implement .bdrv_detach/attach_aio_context()Stefan Hajnoczi1-77/+115
The curl block driver uses fd handlers, timers, and BHs. The fd handlers and timers are managed on behalf of libcurl, which controls them using callback functions that the block driver implements. The simplest way to implement .bdrv_detach/attach_aio_context() is to clean up libcurl in the old event loop and initialize it again in the new event loop. We do not need to keep track of anything since there are no pending requests when the AioContext is changed. Also make sure to use aio_set_fd_handler() instead of qemu_aio_set_fd_handler() and aio_bh_new() instead of qemu_bh_new() so the current AioContext is passed in. Cc: Alexander Graf <agraf@suse.de> Cc: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Fam Zheng <famz@redhat.com>
2014-06-04blkverify: implement .bdrv_detach/attach_aio_context()Stefan Hajnoczi1-13/+34
Drop the assumption that we're using the main AioContext. Convert qemu_bh_new() to aio_bh_new() and qemu_aio_wait() to aio_poll() so we use the BlockDriverState's AioContext. Implement .bdrv_detach/attach_aio_context() interfaces to propagate detach/attach to BDRVBlkverifyState->test_file. The block layer takes care of ->file and ->backing_hd but doesn't know about our ->test_file BlockDriverState, which is also part of the graph. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-06-04blkdebug: use BlockDriverState's AioContextStefan Hajnoczi1-1/+1
Drop the assumption that we're using the main AioContext. Convert qemu_bh_new() to aio_bh_new() so we use the BlockDriverState's AioContext. The .bdrv_detach_aio_context() and .bdrv_attach_aio_context() interfaces are not needed since no fd handlers, timers, or BHs stay registered when requests have been drained. Cc: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-30vmdk: Fix local_err in vmdk_createFam Zheng1-4/+4
In vmdk_create and vmdk_create_extent, initialize local_err before using it, and don't leak it on error. Reported-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-05-30block/raw-posix.c: Avoid nonstandard LONG_LONG_MAXPeter Maydell1-1/+1
In the MacOSX specific code in raw-posix.c we use the define LONG_LONG_MAX. This is actually a non-standard pre-C99 define; switch to using the standard LLONG_MAX instead. This apparently fixes a compilation failure with certain compiler/OS versions (though it is unclear which). Reported-by: Peter Bartoli <peter@bartoli.org> Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-05-30block/sheepdog: Plug memory leak in sd_snapshot_create()Markus Armbruster1-2/+2
Has always been leaky. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-05-30block/vvfat: Plug memory leak in read_directory()Markus Armbruster1-1/+3
Has always been leaky. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-05-30block/vvfat: Plug memory leak in check_directory_consistency()Markus Armbruster1-1/+1
On error path. Introduced in commit a046433a. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-05-30block/qapi: Plug memory leak in dump_qobject() case QTYPE_QERRORMarkus Armbruster1-0/+1
Introduced in commit a8d8ecb. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-05-30qcow2: Plug memory leak on qcow2_invalidate_cache() error pathsMarkus Armbruster1-2/+1
Introduced in commit 5a8a30d. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-05-30block/vvfat: Plug memory leak in enable_write_target()Markus Armbruster1-0/+1
I figure the leak originated in bdrv_create2(), and was duplicated into callers when commit 91a073a dropped that function. Looks like the other places have since been fixed. Spotted by Coverity. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Benoit Canet <benoit@irqsave.net> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2014-05-28block/sheepdog: Don't use qerror_report()Markus Armbruster1-13/+13
qerror_report() is a transitional interface to help with converting existing HMP commands to QMP. It should not be used elsewhere. Replace by error_report(). Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block/sheepdog: Fix silent sd_open(), sd_create() failuresMarkus Armbruster1-0/+5
Open and create methods must set an error when they fail. Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block/sheepdog: Propagate errors to open and create methodsMarkus Armbruster1-28/+12
Completes the conversion to Error started in commit 015a103^..d5124c0, except for a few bugs fixed in the next commit. Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block/sheepdog: Propagate errors through find_vdi_name()Markus Armbruster1-9/+11
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block/sheepdog: Propagate errors through do_sd_create()Markus Armbruster1-14/+21
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block/sheepdog: Propagate errors through sd_prealloc()Markus Armbruster1-7/+13
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block/sheepdog: Propagate errors through get_sheep_fd()Markus Armbruster1-8/+10
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block/sheepdog: Propagate errors through connect_to_sdog()Markus Armbruster1-22/+55
Cc: MORITA Kazutaka <morita.kazutaka@lab.ntt.co.jp> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block/vvfat: Propagate errors through init_directories()Markus Armbruster1-7/+9
Completes the conversion of the open method to Error started in commit 015a103. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block/vvfat: Propagate errors through enable_write_target()Markus Armbruster1-11/+7
Continues the conversion of the open method to Error started in commit 015a103. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block/ssh: Propagate errors to open and create methodsMarkus Armbruster1-25/+22
Completes the conversion to Error started in commit 015a103^..d5124c0. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block/ssh: Propagate errors through connect_to_ssh()Markus Armbruster1-17/+17
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block/ssh: Propagate errors through authenticate()Markus Armbruster1-9/+14
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block/ssh: Propagate errors through check_host_key()Markus Armbruster1-19/+49
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block/ssh: Drop superfluous libssh2_session_last_errno() callsMarkus Armbruster1-5/+4
libssh2_session_last_error() already returns the error code. Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Richard W.M. Jones <rjones@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block/rbd: Propagate errors to open and create methodsMarkus Armbruster1-32/+39
Completes the conversion to Error started in commit 015a103^..d5124c0. Cc: Josh Durgin <josh.durgin@inktank.com> Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block: Add backing_blocker in BlockDriverStateFam Zheng1-1/+1
This makes use of op_blocker and blocks all the operations except for commit target, on each BlockDriverState->backing_hd. The asserts for op_blocker in bdrv_swap are removed because with this change, the target of block commit has at least the backing blocker of its child, so the assertion is not true. Callers should do their check. Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28block: Use bdrv_set_backing_hd everywhereFam Zheng2-3/+3
We need to handle the coming backing_blocker properly, so don't open code the assignment, instead, call bdrv_set_backing_hd to change backing_hd. Signed-off-by: Fam Zheng <famz@redhat.com> Reviewed-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-28qcow2: Fix memory leak in COW error pathKevin Wolf1-1/+2
This triggers if bs->drv becomes NULL in a concurrent request. This is currently only the case when corruption prevention kicks in (i.e. at most once per image, and after that it produces I/O errors). Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2014-05-22Merge remote-tracking branch 'remotes/bonzini/scsi-next' into stagingPeter Maydell1-3/+1
* remotes/bonzini/scsi-next: megasas: remove buildtime strings block: iscsi build fix if LIBISCSI_FEATURE_IOVECTOR is not defined virtio-scsi: Plug memory leak on virtio_scsi_push_event() error path scsi: Document intentional fall through in scsi_req_length() Signed-off-by: Peter Maydell <peter.maydell@linaro.org>