From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NWq3C-0007hI-34 for qemu-devel@nongnu.org; Mon, 18 Jan 2010 06:45:42 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NWq36-0007fc-RU for qemu-devel@nongnu.org; Mon, 18 Jan 2010 06:45:41 -0500 Received: from [199.232.76.173] (port=52695 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NWq36-0007fK-LM for qemu-devel@nongnu.org; Mon, 18 Jan 2010 06:45:36 -0500 Received: from mx1.redhat.com ([209.132.183.28]:56036) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NWq36-00076n-3T for qemu-devel@nongnu.org; Mon, 18 Jan 2010 06:45:36 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0IBjZLf017313 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 18 Jan 2010 06:45:35 -0500 Message-ID: <4B5449DC.20807@redhat.com> Date: Mon, 18 Jan 2010 13:45:32 +0200 From: Naphtali Sprei MIME-Version: 1.0 References: <1263739695-13043-1-git-send-email-nsprei@redhat.com> <1263739695-13043-2-git-send-email-nsprei@redhat.com> <1263739695-13043-3-git-send-email-nsprei@redhat.com> <1263739695-13043-4-git-send-email-nsprei@redhat.com> <1263739695-13043-5-git-send-email-nsprei@redhat.com> <20100117145859.GB3420@redhat.com> In-Reply-To: <20100117145859.GB3420@redhat.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH v2 4/4] Disable fall-back to read-only when cannot open drive's file for read-write List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org Michael S. Tsirkin wrote: > On Sun, Jan 17, 2010 at 04:48:15PM +0200, Naphtali Sprei wrote: >> Signed-off-by: Naphtali Sprei >> --- >> block.c | 6 ------ >> 1 files changed, 0 insertions(+), 6 deletions(-) >> >> diff --git a/block.c b/block.c >> index 8def3c4..f90e983 100644 >> --- a/block.c >> +++ b/block.c >> @@ -444,8 +444,6 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, >> if (flags & (BDRV_O_CACHE_WB|BDRV_O_NOCACHE)) >> bs->enable_write_cache = 1; >> >> - /* Note: for compatibility, we open disk image files as RDWR, and >> - RDONLY as fallback */ >> bs->read_only = (flags & BDRV_O_RDWR) == 0; >> if (!(flags & BDRV_O_FILE)) { >> open_flags = (flags & (BDRV_O_RDWR | BDRV_O_CACHE_MASK|BDRV_O_NATIVE_AIO)); >> @@ -459,10 +457,6 @@ int bdrv_open2(BlockDriverState *bs, const char *filename, int flags, >> ret = -ENOTSUP; >> } else { >> ret = drv->bdrv_open(bs, filename, open_flags); >> - if ((ret == -EACCES || ret == -EPERM) && !(flags & BDRV_O_FILE)) { >> - ret = drv->bdrv_open(bs, filename, open_flags & ~BDRV_O_RDWR); >> - bs->read_only = 1; >> - } > > Maybe print an error message explaining the problem and > suggesting the solution? Printing done in (some of the) callers. Should add suggestion. How is it done in QMP ? > >> } >> if (ret < 0) { >> qemu_free(bs->opaque); >> -- >> 1.6.3.3 >> >>