From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:47913) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cBl6E-0000Bx-JP for qemu-devel@nongnu.org; Tue, 29 Nov 2016 11:17:43 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cBl6A-0007i7-TC for qemu-devel@nongnu.org; Tue, 29 Nov 2016 11:17:42 -0500 From: Kevin Wolf Date: Tue, 29 Nov 2016 17:17:05 +0100 Message-Id: <1480436227-2211-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1480436227-2211-1-git-send-email-kwolf@redhat.com> References: <1480436227-2211-1-git-send-email-kwolf@redhat.com> Subject: [Qemu-devel] [PULL 2/4] qcow2: Allow 'cache-clean-interval' in Linux only List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-block@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com, qemu-devel@nongnu.org From: Alberto Garcia The cache-clean-interval option of qcow2 only works on Linux. However we allow setting it in other systems regardless of whether it works or not. In those systems this option is not simply a no-op: it actually invalidates perfectly valid cache tables for no good reason without freeing their memory. This patch forbids using that option in non-Linux systems. Signed-off-by: Alberto Garcia Signed-off-by: Kevin Wolf --- block/qcow2.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/block/qcow2.c b/block/qcow2.c index 7cfcd84..ed9e0f3 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -668,6 +668,14 @@ static int qcow2_update_options_prepare(BlockDriverState *bs, r->cache_clean_interval = qemu_opt_get_number(opts, QCOW2_OPT_CACHE_CLEAN_INTERVAL, s->cache_clean_interval); +#ifndef CONFIG_LINUX + if (r->cache_clean_interval != 0) { + error_setg(errp, QCOW2_OPT_CACHE_CLEAN_INTERVAL + " not supported on this host"); + ret = -EINVAL; + goto fail; + } +#endif if (r->cache_clean_interval > UINT_MAX) { error_setg(errp, "Cache clean interval too big"); ret = -EINVAL; -- 1.8.3.1