From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mxbwf-00028A-2D for qemu-devel@nongnu.org; Tue, 13 Oct 2009 03:37:21 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mxbwa-00027a-EF for qemu-devel@nongnu.org; Tue, 13 Oct 2009 03:37:20 -0400 Received: from [199.232.76.173] (port=47390 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mxbwa-00027X-9I for qemu-devel@nongnu.org; Tue, 13 Oct 2009 03:37:16 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16371) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MxbwZ-0008Ae-Pr for qemu-devel@nongnu.org; Tue, 13 Oct 2009 03:37:16 -0400 Message-ID: <4AD42DE3.8000000@redhat.com> Date: Tue, 13 Oct 2009 09:36:03 +0200 From: Kevin Wolf MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] Add readonly flag to -drive command References: <4AD32550.8040901@redhat.com> <4AD32DF6.4050100@redhat.com> <20091012135032.GA13560@shareable.org> <4AD33D6D.9020900@codemonkey.ws> <4AD3562F.8000106@msgid.tls.msk.ru> In-Reply-To: <4AD3562F.8000106@msgid.tls.msk.ru> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Michael Tokarev Cc: Naphtali Sprei , qemu-devel@nongnu.org Am 12.10.2009 18:15, schrieb Michael Tokarev: > Anthony Liguori wrote: >> Jamie Lokier wrote: >>> Kevin Wolf wrote: >>> >>>> Am 12.10.2009 14:47, schrieb Naphtali Sprei: >>>> >>>>> In order to safely share an image between guests (as read only >>>>> drive), add a 'readonly' flag >>>>> to the -drive command (qemu command line and monitor). >>> >>> Heh. I've been sharing images between guests for ages - using "chmod -r" :-) >> >> Were it not for backwards compatibility, I would remove that and have it >> error out. >> >> I've had multiple people end up with strangely broken guests because >> they didn't realize the image was read only. > > And I had this issue too. > > But for me it's still not clear. Some disk drives out there can be > switched to read-only mode at runtime by using appropriate command. > Certain (USB and especially SD) flash drives can be read-only too > (usually a tiny swith does that). Even old good floppy drives had > a "write protect" switch. How the system determines if such devices > are read-only? For a HDD or a flash drive, I *guess* the drive return > appropriate error message, no? > > But qemu - apparently - just ignores writes in this case, which > results in stalled guest which expects some answer to the write > command.. I guess, because it was always the stalls. The qemu block layer returns errors. For good old bdrv_write it's -EACCES, for bdrv_aio_writev it's NULL (and therefore cannot be distinguished from other errors). Not sure what the devices make out of it. Probably not the right thing in all cases. Kevin