diff options
Diffstat (limited to 'block')
-rw-r--r-- | block/io.c | 20 | ||||
-rw-r--r-- | block/mirror.c | 2 | ||||
-rw-r--r-- | block/qcow2-cache.c | 3 | ||||
-rw-r--r-- | block/raw-posix.c | 3 | ||||
-rw-r--r-- | block/snapshot.c | 2 |
5 files changed, 15 insertions, 15 deletions
diff --git a/block/io.c b/block/io.c index 305e0d952e..d4bc83b33b 100644 --- a/block/io.c +++ b/block/io.c @@ -236,12 +236,12 @@ static bool bdrv_requests_pending(BlockDriverState *bs) /* * Wait for pending requests to complete on a single BlockDriverState subtree * - * See the warning in bdrv_drain_all(). This function can only be called if - * you are sure nothing can generate I/O because you have op blockers - * installed. - * * Note that unlike bdrv_drain_all(), the caller must hold the BlockDriverState * AioContext. + * + * Only this BlockDriverState's AioContext is run, so in-flight requests must + * not depend on events in other AioContexts. In that case, use + * bdrv_drain_all() instead. */ void bdrv_drain(BlockDriverState *bs) { @@ -260,12 +260,6 @@ void bdrv_drain(BlockDriverState *bs) * * This function does not flush data to disk, use bdrv_flush_all() for that * after calling this function. - * - * Note that completion of an asynchronous I/O operation can trigger any - * number of other I/O operations on other devices---for example a coroutine - * can be arbitrarily complex and a constant flow of I/O can come until the - * coroutine is complete. Because of this, it is not possible to have a - * function to drain a single device's I/O queue. */ void bdrv_drain_all(void) { @@ -288,6 +282,12 @@ void bdrv_drain_all(void) } } + /* Note that completion of an asynchronous I/O operation can trigger any + * number of other I/O operations on other devices---for example a + * coroutine can submit an I/O request to another device in response to + * request completion. Therefore we must keep looping until there was no + * more activity rather than simply draining each device independently. + */ while (busy) { busy = false; diff --git a/block/mirror.c b/block/mirror.c index 8888cea952..d409337c4a 100644 --- a/block/mirror.c +++ b/block/mirror.c @@ -708,6 +708,8 @@ static void mirror_start_job(BlockDriverState *bs, BlockDriverState *target, s->dirty_bitmap = bdrv_create_dirty_bitmap(bs, granularity, NULL, errp); if (!s->dirty_bitmap) { + g_free(s->replaces); + block_job_release(bs); return; } bdrv_set_enable_write_cache(s->target, true); diff --git a/block/qcow2-cache.c b/block/qcow2-cache.c index ed92a098c4..53b8afc3d3 100644 --- a/block/qcow2-cache.c +++ b/block/qcow2-cache.c @@ -281,9 +281,6 @@ static int qcow2_cache_do_get(BlockDriverState *bs, Qcow2Cache *c, i = min_lru_index; trace_qcow2_cache_get_replace_entry(qemu_coroutine_self(), c == s->l2_table_cache, i); - if (i < 0) { - return i; - } ret = qcow2_cache_entry_flush(bs, c, i); if (ret < 0) { diff --git a/block/raw-posix.c b/block/raw-posix.c index cbe6574bf4..855febed52 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -2430,7 +2430,8 @@ static int floppy_probe_device(const char *filename) struct stat st; if (strstart(filename, "/dev/fd", NULL) && - !strstart(filename, "/dev/fdset/", NULL)) { + !strstart(filename, "/dev/fdset/", NULL) && + !strstart(filename, "/dev/fd/", NULL)) { prio = 50; } diff --git a/block/snapshot.c b/block/snapshot.c index 19395ae014..49e143e991 100644 --- a/block/snapshot.c +++ b/block/snapshot.c @@ -239,7 +239,7 @@ int bdrv_snapshot_delete(BlockDriverState *bs, } /* drain all pending i/o before deleting snapshot */ - bdrv_drain_all(); + bdrv_drain(bs); if (drv->bdrv_snapshot_delete) { return drv->bdrv_snapshot_delete(bs, snapshot_id, name, errp); |