From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58032) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgD82-0004CP-3t for qemu-devel@nongnu.org; Mon, 20 Oct 2014 09:36:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XgD7x-0007Bj-Gp for qemu-devel@nongnu.org; Mon, 20 Oct 2014 09:36:06 -0400 Received: from mx1.redhat.com ([209.132.183.28]:32370) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XgD7x-0007BV-A6 for qemu-devel@nongnu.org; Mon, 20 Oct 2014 09:36:01 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s9KDa0Lu008418 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Mon, 20 Oct 2014 09:36:00 -0400 From: Kevin Wolf Date: Mon, 20 Oct 2014 15:35:28 +0200 Message-Id: <1413812154-11153-3-git-send-email-kwolf@redhat.com> In-Reply-To: <1413812154-11153-1-git-send-email-kwolf@redhat.com> References: <1413812154-11153-1-git-send-email-kwolf@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL 02/28] block/raw-posix: Fix disk corruption in try_fiemap List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com From: Tony Breeds Using fiemap without FIEMAP_FLAG_SYNC is a known corrupter. Add the FIEMAP_FLAG_SYNC flag to the FS_IOC_FIEMAP ioctl. This has the downside of significantly reducing performance. Reported-By: Michael Steffens Signed-off-by: Tony Breeds Cc: Kevin Wolf Cc: Markus Armbruster Cc: Stefan Hajnoczi Cc: Max Reitz Cc: P=C3=A1draig Brady Cc: Eric Blake Reviewed-by: Eric Blake Reviewed-by: Max Reitz Signed-off-by: Kevin Wolf --- block/raw-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/raw-posix.c b/block/raw-posix.c index 86ce4f2..d672c73 100644 --- a/block/raw-posix.c +++ b/block/raw-posix.c @@ -1482,7 +1482,7 @@ static int64_t try_fiemap(BlockDriverState *bs, off= _t start, off_t *data, =20 f.fm.fm_start =3D start; f.fm.fm_length =3D (int64_t)nb_sectors * BDRV_SECTOR_SIZE; - f.fm.fm_flags =3D 0; + f.fm.fm_flags =3D FIEMAP_FLAG_SYNC; f.fm.fm_extent_count =3D 1; f.fm.fm_reserved =3D 0; if (ioctl(s->fd, FS_IOC_FIEMAP, &f) =3D=3D -1) { --=20 1.8.3.1