From patchwork Fri Aug 7 10:03:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Swapnil Ingle X-Patchwork-Id: 11705397 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF55A1392 for ; Fri, 7 Aug 2020 10:05:24 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 975D720748 for ; Fri, 7 Aug 2020 10:05:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=sendgrid.net header.i=@sendgrid.net header.b="PYvKwbhd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 975D720748 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nutanix.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Received: from localhost ([::1]:51084 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3zFb-0000Up-Ti for patchwork-qemu-devel@patchwork.kernel.org; Fri, 07 Aug 2020 06:05:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:38798) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3zDj-0005Ng-TG for qemu-devel@nongnu.org; Fri, 07 Aug 2020 06:03:27 -0400 Received: from o1.dev.nutanix.com ([198.21.4.205]:53379) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3zDi-0006Wv-93 for qemu-devel@nongnu.org; Fri, 07 Aug 2020 06:03:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sendgrid.net; h=from:subject:to:cc:content-type:content-transfer-encoding; s=smtpapi; bh=EJ7gXKm+dF7hUMEmQAYNZk1RRM4eLdL+UyukHy3qQIk=; b=PYvKwbhdf4tUHcwUfieJ2t+u+Lhbf6SNx0vZ3Tma2P1XKXxy3Ry4lNLzgv/i1vQrvgsL 8wqZvWkjNQhJpSTENFFEs8nCZ6aqSTdx8xug3hmkNSPXp88tC6rAlw7J1hxhqoP4bU4nbq JpDR60aaDCd58bRaKvx/Jel8yJ+bY28cE= Received: by filterdrecv-p3iad2-d8cc6d457-vbbww with SMTP id filterdrecv-p3iad2-d8cc6d457-vbbww-18-5F2D26EA-11D 2020-08-07 10:03:22.963194328 +0000 UTC m=+748498.735243532 Received: from swapnil-ingle.ubvm.nutanix.com (unknown) by ismtpd0007p1sjc2.sendgrid.net (SG) with ESMTP id qTXmY0oaTBmf1YzBgfibpg Fri, 07 Aug 2020 10:03:22.716 +0000 (UTC) From: Swapnil Ingle Subject: [PATCH v2] block/vhdx: Support vhdx image only with 512 bytes logical sector size Date: Fri, 07 Aug 2020 10:03:23 +0000 (UTC) Message-Id: <1596794594-44531-1-git-send-email-swapnil.ingle@nutanix.com> X-Mailer: git-send-email 1.8.3.1 X-SG-EID: F2ZUz17l2INJHYm1t3SgcUlF+k0ID8lTNwkAb5HHXc8fLM5LiKzEftZo2hMPshg8C4Vps0UmhpJRBoOufhCJs4fp0VRL94dwjCvG0xA21GUZktfi/Hrxgxopmi9IryiHTEMbof67wir+n4RqU/ciB+TYrYnb1nY2MkffztFb5YXsI0pjNM7aGYI5Kep09MSr2irukEra/StnQwQKxLT7+aUFAqFCbVoqxySibEZj1oYTb1ThHUFeJxNBKp6Ve+9Pyw4I5nVbGFyIdXb5REwK+g== To: qemu-devel@nongnu.org Received-SPF: pass client-ip=198.21.4.205; envelope-from=bounces+17973240-45d5-qemu-devel=nongnu.org@sendgrid.net; helo=o1.dev.nutanix.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/08/07 06:03:23 X-ACL-Warn: Detected OS = Linux 3.11 and newer [fuzzy] X-Spam_score_int: -29 X-Spam_score: -3.0 X-Spam_bar: --- X-Spam_report: (-3.0 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_MED=-1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_EF=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=unavailable autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Kevin Wolf , Swapnil Ingle , "open list:VHDX" , Jeff Cody , Max Reitz , philmd@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" block/vhdx uses qemu block layer where sector size is always 512 bytes. This may have issues with 4K logical sector sized vhdx image. For e.g qemu-img convert on such images fails with following assert: $qemu-img convert -f vhdx -O raw 4KTest1.vhdx test.raw qemu-img: util/iov.c:388: qiov_slice: Assertion `offset + len <= qiov->size' failed. Aborted This patch adds an check to return ENOTSUP for vhdx images which have logical sector size other than 512 bytes. Signed-off-by: Swapnil Ingle --- v2: Fixed commit message, suggested by Philippe Mathieu-Daude --- block/vhdx.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/block/vhdx.c b/block/vhdx.c index 791eb90..356ec4c 100644 --- a/block/vhdx.c +++ b/block/vhdx.c @@ -816,9 +816,9 @@ static int vhdx_parse_metadata(BlockDriverState *bs, BDRVVHDXState *s) goto exit; } - /* only 2 supported sector sizes */ - if (s->logical_sector_size != 512 && s->logical_sector_size != 4096) { - ret = -EINVAL; + /* Currently we only support 512 */ + if (s->logical_sector_size != 512) { + ret = -ENOTSUP; goto exit; }