From: Denis V. Lunev Date: Thu, 16 Jun 2016 16:09:41 +0000 (+0300) Subject: block: process before_write_notifiers in bdrv_co_discard X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=ec050f77a549b300ee444634bccd9ec05d134c4d;p=qemu.git block: process before_write_notifiers in bdrv_co_discard This is mandatory for correct backup creation. In the other case the content under this area would be lost. Dirty bits are set exactly like in bdrv_aligned_pwritev, i.e. they are set even if notifier has returned a error. Signed-off-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Fam Zheng Reviewed-by: Eric Blake Message-id: 1466093381-6120-4-git-send-email-den@openvz.org CC: Fam Zheng CC: Stefan Hajnoczi CC: Kevin Wolf CC: Max Reitz Signed-off-by: Stefan Hajnoczi --- diff --git a/block/io.c b/block/io.c index 8ab6f95477..7cf3645ade 100644 --- a/block/io.c +++ b/block/io.c @@ -2350,6 +2350,11 @@ int coroutine_fn bdrv_co_discard(BlockDriverState *bs, int64_t sector_num, tracked_request_begin(&req, bs, sector_num << BDRV_SECTOR_BITS, nb_sectors << BDRV_SECTOR_BITS, BDRV_TRACKED_DISCARD); + ret = notifier_with_return_list_notify(&bs->before_write_notifiers, &req); + if (ret < 0) { + goto out; + } + max_discard = MIN_NON_ZERO(bs->bl.max_discard, BDRV_REQUEST_MAX_SECTORS); while (nb_sectors > 0) { int ret;