From patchwork Wed Aug 5 21:30:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Swapnil Ingle X-Patchwork-Id: 11702561 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 8BC53138A for ; Wed, 5 Aug 2020 21:31:35 +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 259C422CA1 for ; Wed, 5 Aug 2020 21:31:34 +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="IKcMig98" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 259C422CA1 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]:49942 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1k3R0X-0002Vu-TN for patchwork-qemu-devel@patchwork.kernel.org; Wed, 05 Aug 2020 17:31:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:59824) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Qzv-0001rt-Jv for qemu-devel@nongnu.org; Wed, 05 Aug 2020 17:30:55 -0400 Received: from o1.dev.nutanix.com ([198.21.4.205]:20863) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1k3Qzs-0002hn-He for qemu-devel@nongnu.org; Wed, 05 Aug 2020 17:30:55 -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=WqTxKduvpZrcsVm7jnKquaCD51/zhdc974BjMSypsqs=; b=IKcMig98PryJJJh1+OKM4oZZvs/341i5u8vZIy6o7ejqRm03nwXFAq3syA2a/cfumD4G Ay8dgDXZ3bhlocSfqpGT1J4CfttH5hc4knWiJAbhDAl572yFdJohDm/xSRqdBOavWuFdjp S92gzB00m9sMmOb10t6FLFn8+fVJIMR9c= Received: by filterdrecv-p3mdw1-7ff865655c-m2ckz with SMTP id filterdrecv-p3mdw1-7ff865655c-m2ckz-20-5F2B2509-52 2020-08-05 21:30:49.49766156 +0000 UTC m=+616478.486849371 Received: from swapnil-ingle.ubvm.nutanix.com (unknown) by ismtpd0010p1sjc2.sendgrid.net (SG) with ESMTP id XiLUL97RS6KSR12I3oWGuA Wed, 05 Aug 2020 21:30:49.337 +0000 (UTC) From: Swapnil Ingle Subject: [PATCH] block/vhdx: Support vhdx image only with 512 bytes logical sector size Date: Wed, 05 Aug 2020 21:30:49 +0000 (UTC) Message-Id: <1596663040-172084-1-git-send-email-swapnil.ingle@nutanix.com> X-Mailer: git-send-email 1.8.3.1 X-SG-EID: F2ZUz17l2INJHYm1t3SgcUlF+k0ID8lTNwkAb5HHXc8fLM5LiKzEftZo2hMPshg8C4Vps0UmhpJRBoOufhCJs701GHlkbgDY6uPv8BmQTtbLjwsVvvNMw+TzJ7VBcuMHWBEz2X80Oyvj9YlFdnsyulIcG/nNT1kAliNjxH4SGgKzDeq4iVvLXTNpAA1eHGFZULguepuW77RrTbQQ/e/1jBrCRFE3dsCMUmMkiSNm8pYw9HynfNeYHe4dbUIgyz4tyYyASenUppv7bjqJlvVjMg== 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/05 17:30:49 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: Jeff Cody , Kevin Wolf , "open list:VHDX" , Swapnil Ingle , Max Reitz 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 byte. 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 has logical sector size other than 512 bytes. Signed-off-by: Swapnil Ingle --- 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; }