From 12bde0eed6b740787bca2c998a838b20c556d0ec Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 30 Mar 2012 13:17:10 +0200 Subject: 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 Reviewed-by: Stefan Hajnoczi Signed-off-by: Kevin Wolf --- blockdev.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'blockdev.c') diff --git a/blockdev.c b/blockdev.c index f5e7dba..4d17486 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; } -- cgit v1.1