From patchwork Sun Aug 26 14:09:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alberto Garcia X-Patchwork-Id: 10576279 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 698FD14BD for ; Sun, 26 Aug 2018 14:15:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5B1AD292C4 for ; Sun, 26 Aug 2018 14:15:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4D5E229323; Sun, 26 Aug 2018 14:15:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id F0276292C4 for ; Sun, 26 Aug 2018 14:15:24 +0000 (UTC) Received: from localhost ([::1]:49243 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ftvp6-0002ZI-8E for patchwork-qemu-devel@patchwork.kernel.org; Sun, 26 Aug 2018 10:15:24 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ftvl9-00082o-Gz for qemu-devel@nongnu.org; Sun, 26 Aug 2018 10:11:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ftvl6-0006zC-Bi for qemu-devel@nongnu.org; Sun, 26 Aug 2018 10:11:19 -0400 Received: from fanzine.igalia.com ([91.117.99.155]:59581) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ftvl4-0006U5-0A; Sun, 26 Aug 2018 10:11:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=References:In-Reply-To:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=g0yeizXw22aVEbGSgxZQQQMYnevWLptyviOHfesip4A=; b=ovs+3DqApQeSWN4EjeN0s1FXdMFw2iiwV5NnNJyfa+C4SsMtab2q/WRqM3JBX7rTzXEYUEs5G5oQsn8+gFJwtyPxoZWeDSExMM86PkAyOXD+Vsf0+mRGTWDh2MBj0NWIsJEjKqXU9kcBO2VrNr88blT4oKI12iCr/rCWumm6svcYJkZPXoOOZ8ExQanP2g6xNHJLvVZIRAl4RODLzPBwx2nBIMx+8MlsNaJFwq1exBqCm2oO6yfIVbtecUcHjBt3rtEXvW9N4M6yOdlPg1345pp3yFPmnL9eSf7qQavQeDkGTBFyOEDmo7mIDpQ3XyS/CQMmPxuEfpsdpJw5UDKy4Q==; Received: from 85-76-74-234-nat.elisa-mobile.fi ([85.76.74.234] helo=perseus.local) by fanzine.igalia.com with esmtpsa (Cipher TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim) id 1ftvkQ-0004AN-Ka; Sun, 26 Aug 2018 16:10:34 +0200 Received: from berto by perseus.local with local (Exim 4.89) (envelope-from ) id 1ftvkB-0004mQ-8m; Sun, 26 Aug 2018 17:10:19 +0300 From: Alberto Garcia To: qemu-devel@nongnu.org Date: Sun, 26 Aug 2018 17:09:37 +0300 Message-Id: <599f98e81407a82d8b05764eeac7dbcf5f52142d.1535291602.git.berto@igalia.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x (no timestamps) [generic] [fuzzy] X-Received-From: 91.117.99.155 Subject: [Qemu-devel] [PATCH 6/9] file-posix: Forbid trying to change unsupported options during reopen X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Alberto Garcia , qemu-block@nongnu.org, Max Reitz Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP The file-posix code is used for the "file", "host_device" and "host_cdrom" drivers, and it allows reopening images. However the only option that is actually processed is "x-check-cache-dropped", and changes in all other options (e.g. "filename") are silently ignored: (qemu) qemu-io virtio0 "reopen -o file.filename=no-such-file" While we could allow changing some of the other options, let's keep things as they are for now but return an error if the user tries to change any of them. Signed-off-by: Alberto Garcia --- block/file-posix.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/block/file-posix.c b/block/file-posix.c index ddac0cc3e6..d4ec2cb3dd 100644 --- a/block/file-posix.c +++ b/block/file-posix.c @@ -850,8 +850,13 @@ static int raw_reopen_prepare(BDRVReopenState *state, goto out; } - rs->check_cache_dropped = qemu_opt_get_bool(opts, "x-check-cache-dropped", - false); + rs->check_cache_dropped = + qemu_opt_get_bool_del(opts, "x-check-cache-dropped", false); + + /* This driver's reopen function doesn't currently allow changing + * other options, so let's put them back in the original QDict and + * bdrv_reopen_prepare() will detect changes and complain. */ + qemu_opts_to_qdict(opts, state->options); if (s->type == FTYPE_CD) { rs->open_flags |= O_NONBLOCK;