aboutsummaryrefslogtreecommitdiff
path: root/block.c
diff options
context:
space:
mode:
authorMarcelo Tosatti <mtosatti@redhat.com>2011-01-26 12:12:35 -0200
committerKevin Wolf <kwolf@redhat.com>2011-02-07 12:51:19 +0100
commit8591675f44929a9e4b5d3a5fd702a4b6d41c7903 (patch)
tree1ad3ac6b6d162ea31f952922e1e4f4b7dce74725 /block.c
parentdb593f2565dc12442d6bac9e8eaefa027dfcada9 (diff)
block: enable in_use flag
Set block device in use during block migration, disallow drive_del and bdrv_truncate for in use devices. Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com> Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r--block.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/block.c b/block.c
index ee9edfce2c..b476479e0d 100644
--- a/block.c
+++ b/block.c
@@ -1132,6 +1132,8 @@ int bdrv_truncate(BlockDriverState *bs, int64_t offset)
return -ENOTSUP;
if (bs->read_only)
return -EACCES;
+ if (bdrv_in_use(bs))
+ return -EBUSY;
ret = drv->bdrv_truncate(bs, offset);
if (ret == 0) {
ret = refresh_total_sectors(bs, offset >> BDRV_SECTOR_BITS);