diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-03-30 13:17:10 +0200 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2012-04-05 14:54:40 +0200 |
commit | 12bde0eed6b740787bca2c998a838b20c556d0ec (patch) | |
tree | 70575b80de60a28bdae472b679caaba8d0299f3a /blockdev.c | |
parent | 498e386c58497f621a37301ea6e8ca886f9f2e07 (diff) |
block: cancel jobs when a device is ready to go away
We do not want jobs to keep a device busy for a possibly very long
time, and management could become confused because they thought a
device was not even there anymore. So, cancel long-running jobs
as soon as their device is going to disappear.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'blockdev.c')
-rw-r--r-- | blockdev.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/blockdev.c b/blockdev.c index f5e7dba90c..4d17486e31 100644 --- a/blockdev.c +++ b/blockdev.c @@ -64,6 +64,9 @@ void blockdev_mark_auto_del(BlockDriverState *bs) { DriveInfo *dinfo = drive_get_by_blockdev(bs); + if (bs->job) { + block_job_cancel(bs->job); + } if (dinfo) { dinfo->auto_del = 1; } |