From patchwork Wed Jan 18 18:39:35 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Fabian Frederick X-Patchwork-Id: 9524557 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 787D46020B for ; Wed, 18 Jan 2017 18:40:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 691A1285EB for ; Wed, 18 Jan 2017 18:40:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A6F22860E; Wed, 18 Jan 2017 18:40:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0EDAF285EB for ; Wed, 18 Jan 2017 18:40:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752550AbdARSjv (ORCPT ); Wed, 18 Jan 2017 13:39:51 -0500 Received: from mailrelay109.isp.belgacom.be ([195.238.20.136]:55548 "EHLO mailrelay109.isp.belgacom.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751404AbdARSju (ORCPT ); Wed, 18 Jan 2017 13:39:50 -0500 X-Belgacom-Dynamic: yes X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A2B3AwActn9Y/+M5QFddHAEBFgEBBQEBg?= =?us-ascii?q?l1PAQEBAQEfgWmOS5E3AZUEgguGIoIEQBgBAgEBAQEBAQFjKIUXLyMpcSQTiHY?= =?us-ascii?q?RsXA6hBCGWoZLjxsFiHeHdopUkVUNgXeIW4Ybkm8fOIEnGhiEIgFLAxyBYT01i?= =?us-ascii?q?QEBAQE?= X-IPAS-Result: =?us-ascii?q?A2B3AwActn9Y/+M5QFddHAEBFgEBBQEBgl1PAQEBAQEfgWm?= =?us-ascii?q?OS5E3AZUEgguGIoIEQBgBAgEBAQEBAQFjKIUXLyMpcSQTiHYRsXA6hBCGWoZLj?= =?us-ascii?q?xsFiHeHdopUkVUNgXeIW4Ybkm8fOIEnGhiEIgFLAxyBYT01iQEBAQE?= Received: from 227.57-64-87.adsl-dyn.isp.belgacom.be (HELO localhost.localdomain) ([87.64.57.227]) by relay.skynet.be with ESMTP; 18 Jan 2017 19:39:42 +0100 From: Fabian Frederick To: Jan Kara Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, fabf@skynet.be Subject: [RFC 1/1 linux-next] udf: allow implicit blocksize specification during mount Date: Wed, 18 Jan 2017 19:39:35 +0100 Message-Id: <20170118183935.32503-1-fabf@skynet.be> X-Mailer: git-send-email 2.9.3 Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP udf_fill_super() used udf_parse_options() to flag UDF_FLAG_BLOCKSIZE_SET when blocksize was specified otherwise used 512 bytes (bdev_logical_block_size) and 2048 bytes (UDF_DEFAULT_BLOCKSIZE) IOW both 1024 and 4096 specifications were required or resulted in "mount: wrong fs type, bad option, bad superblock on /dev/loop1" This patch loops through different block values but also updates udf_load_vrs() to return -EINVAL instead of 0 when udf_check_vsd() fails (and uopt->novrs = 0). The later being the reason for the RFC; we have that case when mounting a 4kb blocksize against other values but maybe VRS is not mandatory there ? Tested with 512, 1024, 2048 and 4096 blocksize Reported-by: Jan Kara Signed-off-by: Fabian Frederick --- fs/udf/super.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/fs/udf/super.c b/fs/udf/super.c index 967ad87..078a144 100644 --- a/fs/udf/super.c +++ b/fs/udf/super.c @@ -1957,7 +1957,7 @@ static int udf_load_vrs(struct super_block *sb, struct udf_options *uopt, if (!nsr_off) { if (!silent) udf_warn(sb, "No VRS found\n"); - return 0; + return -EINVAL; } if (nsr_off == -1) udf_debug("Failed to read sector at offset %d. " @@ -2161,15 +2161,19 @@ static int udf_fill_super(struct super_block *sb, void *options, int silent) ret = udf_load_vrs(sb, &uopt, silent, &fileset); } else { uopt.blocksize = bdev_logical_block_size(sb->s_bdev); - ret = udf_load_vrs(sb, &uopt, silent, &fileset); - if (ret == -EAGAIN && uopt.blocksize != UDF_DEFAULT_BLOCKSIZE) { - if (!silent) - pr_notice("Rescanning with blocksize %d\n", - UDF_DEFAULT_BLOCKSIZE); - brelse(sbi->s_lvid_bh); - sbi->s_lvid_bh = NULL; - uopt.blocksize = UDF_DEFAULT_BLOCKSIZE; + while (uopt.blocksize <= 4096) { ret = udf_load_vrs(sb, &uopt, silent, &fileset); + if (ret < 0) { + if (!silent) { + pr_notice("Scanning with blocksize %d failed\n", + uopt.blocksize); + } + brelse(sbi->s_lvid_bh); + sbi->s_lvid_bh = NULL; + } else + break; + + uopt.blocksize <<= 1; } } if (ret < 0) {