Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10526245ybi; Thu, 11 Jul 2019 06:44:45 -0700 (PDT) X-Google-Smtp-Source: APXvYqxwkv+SeKKR1dhMi0DCjowUhP6dhSgEu67gZjJAsGrZRs3ucpon/190nN4xuztxnrYB5OYO X-Received: by 2002:a17:90a:2ec1:: with SMTP id h1mr4997251pjs.119.1562852685764; Thu, 11 Jul 2019 06:44:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562852685; cv=none; d=google.com; s=arc-20160816; b=ZIRvrKNeAUCF/JNLWaJtyji+WLpnt/ZQH/y8c0YzYSM9LhlMaZ98vnlB8lGYX7RMwt dpD0trFGoIPMP5ghvC4bIvggZht0nhhXdKl9+G3znGU1DTOgZRiHuiX1CpytHcUEDV0/ j9DDKoHBS203KQVbkfaNZgeSzP0l0Zn8lYpSAsUuUPkUywwUJwlGePF7XI21dzL09U1+ uvndsv9hN2X+RU1uq418P0A2mvQgDvZwUQpfFSMp3LuXSXBlKZAbhVmzZBMRzklApUOn /CVmIThHzrkj9fnOzZwr+oPiwm+z1GKcym1Ch9qrWZNjkJHVexyVuvnwNKRmux0rU1mc wiOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=shtQwTN82SLzlsJ+3Dw6r1akGAa25vF9P/FWU52bI/A=; b=o7SyMLr7zxr4EeGlvCuDEsZDlvj2XT0tNsm6u5avmptVjQ/vxUK2b/81Xm0/H+wiJI 7nvuSG77hPL/yi6Fl9boKubCpZUM/+pXsLOtibucK68r1O32SUWAjPpYkP0/ZtB2oesD ACSqEwevuBmyFG2goh2xehJqUf+U7JEsmCo6XCiF6k5xKW2vvVET5AkdO/+onKHWgyww o0eQHAsNWCu0wQLVu7ZgqFraz0YCnChzm/ZHaF/AL/FXgobrlEninW6lUmPQvhh/duoa aqrVbrl02U8gGF+fhdXHAk+XL/Oor0UpUTsCEfKGsdpbbV4+QIWANA4yRk2A3keGjUb7 HiNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digidescorp.com header.s=google header.b=J6xUpl3L; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h32si5051057pld.402.2019.07.11.06.44.29; Thu, 11 Jul 2019 06:44:45 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@digidescorp.com header.s=google header.b=J6xUpl3L; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728689AbfGKNjw (ORCPT + 99 others); Thu, 11 Jul 2019 09:39:52 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:39340 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728571AbfGKNjt (ORCPT ); Thu, 11 Jul 2019 09:39:49 -0400 Received: by mail-io1-f68.google.com with SMTP id f4so12586865ioh.6 for ; Thu, 11 Jul 2019 06:39:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=digidescorp.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=shtQwTN82SLzlsJ+3Dw6r1akGAa25vF9P/FWU52bI/A=; b=J6xUpl3LGrcfXZq9XYXjgjQhRvk3EDm/aUvIPtVRdsn6YwB6MeoOX1bVjlXjCz7GyE mhN/3QX3ZTDmfEXUyCsrpXqJ3Y9OCtW321tJHFk+zDlCzYd7UO0cQrTZADPvDL0x7au8 5bqEPMKZS6j4jyKs2f5KGpgI2P4Z2U2RLtUhc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=shtQwTN82SLzlsJ+3Dw6r1akGAa25vF9P/FWU52bI/A=; b=M9zu9pPE5l6jjZMz0JCT//1BzVf1kyYofzWz/XbkB+hPGA8Eea4nSHbOuow99Lt4Ri TyxB+RLZx+JU5YTje7sUClsQTsMRV2Pca7dl4NcBanyQV0J3i7tGwntUr5OikCK+A2oF VmsssgBXgL1X2q0vuHNe0HswPcau88p5G9lX835JdRB8CcD0O2Q6hWuJoGh5my9Q3fLU RQg1AL0dly8T9Snp8a17tQZhMryZj5nBfDujcVCnbyCyBbMZWSxhAQUSyg47mUKopG0L MBmbLALZ0gZaPufviPg0PxgtKHllFr3DfQNoeiH/brjZj1cA9Hkf6dp8UPn6zCueI1br FEmQ== X-Gm-Message-State: APjAAAXL3+IYxdTKhckM4YmIkV0Sp6VN7lCOTUXQlJ4G5f+auEZrhUEZ W2ctSDqmzrva+88ayQrM9xfnMA== X-Received: by 2002:a6b:5115:: with SMTP id f21mr4493812iob.173.1562852388663; Thu, 11 Jul 2019 06:39:48 -0700 (PDT) Received: from iscandar.digidescorp.com (104-51-28-62.lightspeed.cicril.sbcglobal.net. [104.51.28.62]) by smtp.googlemail.com with ESMTPSA id u4sm6035902iol.59.2019.07.11.06.39.47 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Thu, 11 Jul 2019 06:39:48 -0700 (PDT) From: "Steven J. Magnani" X-Google-Original-From: "Steven J. Magnani" To: Jan Kara Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, =?UTF-8?q?Pali=20Roh=C3=A1r?= , "Steven J . Magnani" Subject: [PATCH v2 2/2] udf: support 2048-byte spacing of VRS descriptors on 4K media Date: Thu, 11 Jul 2019 08:38:52 -0500 Message-Id: <20190711133852.16887-2-steve@digidescorp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190711133852.16887-1-steve@digidescorp.com> References: <20190711133852.16887-1-steve@digidescorp.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Some UDF creators (specifically Microsoft, but perhaps others) mishandle the ECMA-167 corner case that requires descriptors within a Volume Recognition Sequence to be placed at 4096-byte intervals on media where the block size is 4K. Instead, the descriptors are placed at the 2048- byte interval mandated for media with smaller blocks. This nonconformity currently prevents Linux from recognizing the filesystem as UDF. Modify the driver to tolerate a misformatted VRS on 4K media. Signed-off-by: Steven J. Magnani --- a/fs/udf/super.c 2019-07-10 20:55:33.334359446 -0500 +++ b/fs/udf/super.c 2019-07-10 21:20:58.138382326 -0500 @@ -741,6 +741,7 @@ static int udf_check_vsd(struct super_bl int sectorsize; struct buffer_head *bh = NULL; int nsr = 0; + int quirk_nsr = 0; struct udf_sb_info *sbi; sbi = UDF_SB(sb); @@ -780,11 +781,27 @@ static int udf_check_vsd(struct super_bl if (vsd_id > nsr) nsr = vsd_id; + /* Special handling for improperly formatted VRS (e.g., Win10) + * where components are separated by 2048 bytes + * even though sectors are 4K + */ + if ((sb->s_blocksize == 4096) && (quirk_nsr < 2)) { + vsd_id = identify_vsd(vsd + 1); + if ((nsr == 1) || (quirk_nsr == 1)) { + /* BEA01 has been seen, allow quirk NSR */ + if (vsd_id > quirk_nsr) + quirk_nsr = vsd_id; + } else if (vsd_id > 3) + quirk_nsr = vsd_id; /* 0 -> 255 */ + } + brelse(bh); } if ((nsr >= 2) && (nsr <= 3)) return nsr; + else if ((quirk_nsr >= 2) && (quirk_nsr <= 3)) + return quirk_nsr; else if (!bh && sector - (sbi->s_session << sb->s_blocksize_bits) == VSD_FIRST_SECTOR_OFFSET) return -1;