Received: from eggs.gnu.org ([2001:4830:134:3::10]:40265) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEy2U-0007Cy-87 for qemu-devel@nongnu.org; Thu, 29 Aug 2013 04:57:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VEy2N-0007Xi-Ug for qemu-devel@nongnu.org; Thu, 29 Aug 2013 04:57:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:48914) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VEy2N-0007Xa-LN for qemu-devel@nongnu.org; Thu, 29 Aug 2013 04:57:07 -0400 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r7T8v656016457 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 29 Aug 2013 04:57:07 -0400 Date: Thu, 29 Aug 2013 10:57:20 +0200 From: Kevin Wolf Message-ID: <20130829085720.GE2961@dhcp-200-207.str.redhat.com> References: <1377701706-965-1-git-send-email-mreitz@redhat.com> <1377701706-965-2-git-send-email-mreitz@redhat.com> <20130829082303.GC2961@dhcp-200-207.str.redhat.com> <521F0600.9050701@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <521F0600.9050701@redhat.com> Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH v2 1/5] qcow2: Add corrupt bit List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Max Reitz Cc: qemu-devel@nongnu.org, Stefan Hajnoczi Am 29.08.2013 um 10:27 hat Max Reitz geschrieben: > Am 29.08.2013 10:23, schrieb Kevin Wolf: > >Am 28.08.2013 um 16:55 hat Max Reitz geschrieben: > >>This adds an incompatible bit indicating corruption to qcow2. Any ima= ge > >>with this bit set may not be written to unless for repairing (and > >>subsequently clearing the bit if the repair has been successful). > >> > >>Signed-off-by: Max Reitz > >>--- > >> block/qcow2.c | 45 +++++++++++++++++++++++++++++++++++= ++++++++++ > >> block/qcow2.h | 7 ++++++- > >> docs/specs/qcow2.txt | 7 ++++++- > >> tests/qemu-iotests/031.out | 12 ++++++------ > >> tests/qemu-iotests/036.out | 2 +- > >> 5 files changed, 64 insertions(+), 9 deletions(-) > >>@@ -402,6 +433,15 @@ static int qcow2_open(BlockDriverState *bs, QDic= t *options, int flags) > >> goto fail; > >> } > >>+ if (s->incompatible_features & QCOW2_INCOMPAT_CORRUPT) { > >>+ /* Corrupt images may not be written to unless they are bein= g repaired > >>+ */ > >>+ if ((flags & BDRV_O_RDWR) && !(flags & BDRV_O_CHECK)) { > >>+ ret =3D -EACCES; > >Perhaps a (q)error_report() call would be appropriate so that the user > >isn't confused with only the "Permission denied" message > Seems reasonable. > >(should it be > >EPERM rather than EACCES, too? Or maybe EROFS?) > I chose the value based on the following: > $ touch foo > $ chmod -w foo > $ echo 'bar' > foo > zsh: permission denied: foo > (which is EACCES) Well, the point is that when I get EACCES (i.e. a "Permission denied" message), the first thing I do is to check the file permissions of the image file, because that's really what EACCES says. So it's kind of misleading. > EROFS sounds nice, but I wouldn't go for it since it's the image > that's read-only and not the underlying FS (which I think EROFS is > for=E2=80=A6?) Unfortunately errno values are hardly ever a perfect match... I think I'm less likely to be misled by EROFS because I _know_ that my /home (or /var, for that matter) isn't read-only. In the end, it's probably not all that important as long as we print a clear (q)error_report() message in addition. Kevin