From patchwork Tue Mar 11 06:56:43 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Darrick Wong X-Patchwork-Id: 328960 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4CE672C00C6 for ; Tue, 11 Mar 2014 17:57:05 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754055AbaCKG44 (ORCPT ); Tue, 11 Mar 2014 02:56:56 -0400 Received: from userp1040.oracle.com ([156.151.31.81]:32790 "EHLO userp1040.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753292AbaCKG4t (ORCPT ); Tue, 11 Mar 2014 02:56:49 -0400 Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by userp1040.oracle.com (Sentrion-MTA-4.3.2/Sentrion-MTA-4.3.2) with ESMTP id s2B6uk6B005521 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 11 Mar 2014 06:56:47 GMT Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s2B6ujSU002777 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 11 Mar 2014 06:56:46 GMT Received: from abhmp0011.oracle.com (abhmp0011.oracle.com [141.146.116.17]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id s2B6uj2M003475; Tue, 11 Mar 2014 06:56:45 GMT Received: from localhost (/67.160.151.179) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 10 Mar 2014 23:56:45 -0700 Subject: [PATCH 26/49] tests: add test for corrupted checksummed root directory block To: tytso@mit.edu, darrick.wong@oracle.com From: "Darrick J. Wong" Cc: linux-ext4@vger.kernel.org Date: Mon, 10 Mar 2014 23:56:43 -0700 Message-ID: <20140311065643.30585.824.stgit@birch.djwong.org> In-Reply-To: <20140311065356.30585.47192.stgit@birch.djwong.org> References: <20140311065356.30585.47192.stgit@birch.djwong.org> User-Agent: StGit/0.15 MIME-Version: 1.0 X-Source-IP: acsinet21.oracle.com [141.146.126.237] Sender: linux-ext4-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ext4@vger.kernel.org fsck crashes if we take a checksummed filesystem, zap the root directory block, and try to fix things. If we trash the root directory block, e2fsck will find inode 11 (the old lost+found) and try to attach it to l+f. The lost+found checker also fails to find l+f and tries to add one to the root dir. The root dir is not found but is recreated with incorrect checksums, so linking in the l+f dir fails and the l+f '..' entry isn't set. Since both dirs now fail checksum verification, they're both referred to rehash to have that fixed, but because l+f doesn't have a '..' entry, rehash crashes because l+f has < 2 entries. On a checksumming filesystem, the routines in e2fsck that recreate /lost+found and / must write the new directory block *after* the inode has been written to disk because the checksum depends on i_generation. This will have been fixed in the previous patch, so add a regression test. Signed-off-by: Darrick J. Wong --- tests/f_rebuild_csum_rootdir/expect.1 | 311 +++++++++++++++++++++++++++++++++ tests/f_rebuild_csum_rootdir/expect.2 | 7 + tests/f_rebuild_csum_rootdir/image.gz | Bin tests/f_rebuild_csum_rootdir/name | 1 4 files changed, 319 insertions(+) create mode 100644 tests/f_rebuild_csum_rootdir/expect.1 create mode 100644 tests/f_rebuild_csum_rootdir/expect.2 create mode 100644 tests/f_rebuild_csum_rootdir/image.gz create mode 100644 tests/f_rebuild_csum_rootdir/name -- To unsubscribe from this list: send the line "unsubscribe linux-ext4" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/tests/f_rebuild_csum_rootdir/expect.1 b/tests/f_rebuild_csum_rootdir/expect.1 new file mode 100644 index 0000000..6b5c47b --- /dev/null +++ b/tests/f_rebuild_csum_rootdir/expect.1 @@ -0,0 +1,311 @@ +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Directory inode 2, block #0, offset 0: directory has no checksum +Fix? yes + +Directory inode 2, block #0, offset 0: directory corrupted +Salvage? yes + +Missing '.' in directory inode 2. +Fix? yes + +Setting filetype for entry '.' in ??? (2) to 2. +Missing '..' in directory inode 2. +Fix? yes + +Setting filetype for entry '..' in ??? (2) to 2. +Pass 3: Checking directory connectivity +'..' in / (2) is (0), should be / (2). +Fix? yes + +Unconnected directory inode 11 (/???) +Connect to /lost+found? yes + +/lost+found not found. Create? yes + +Pass 3A: Optimizing directories +Pass 4: Checking reference counts +Inode 11 ref count is 3, should be 2. Fix? yes + +Unattached inode 12 +Connect to /lost+found? yes + +Inode 12 ref count is 2, should be 1. Fix? yes + +Unattached inode 13 +Connect to /lost+found? yes + +Inode 13 ref count is 2, should be 1. Fix? yes + +Unattached inode 14 +Connect to /lost+found? yes + +Inode 14 ref count is 2, should be 1. Fix? yes + +Unattached inode 15 +Connect to /lost+found? yes + +Inode 15 ref count is 2, should be 1. Fix? yes + +Unattached inode 16 +Connect to /lost+found? yes + +Inode 16 ref count is 2, should be 1. Fix? yes + +Unattached inode 17 +Connect to /lost+found? yes + +Inode 17 ref count is 2, should be 1. Fix? yes + +Unattached inode 18 +Connect to /lost+found? yes + +Inode 18 ref count is 2, should be 1. Fix? yes + +Unattached inode 19 +Connect to /lost+found? yes + +Inode 19 ref count is 2, should be 1. Fix? yes + +Unattached inode 20 +Connect to /lost+found? yes + +Inode 20 ref count is 2, should be 1. Fix? yes + +Unattached inode 21 +Connect to /lost+found? yes + +Inode 21 ref count is 2, should be 1. Fix? yes + +Unattached inode 22 +Connect to /lost+found? yes + +Inode 22 ref count is 2, should be 1. Fix? yes + +Unattached inode 23 +Connect to /lost+found? yes + +Inode 23 ref count is 2, should be 1. Fix? yes + +Unattached inode 24 +Connect to /lost+found? yes + +Inode 24 ref count is 2, should be 1. Fix? yes + +Unattached inode 25 +Connect to /lost+found? yes + +Inode 25 ref count is 2, should be 1. Fix? yes + +Unattached inode 26 +Connect to /lost+found? yes + +Inode 26 ref count is 2, should be 1. Fix? yes + +Unattached inode 27 +Connect to /lost+found? yes + +Inode 27 ref count is 2, should be 1. Fix? yes + +Unattached inode 28 +Connect to /lost+found? yes + +Inode 28 ref count is 2, should be 1. Fix? yes + +Unattached inode 29 +Connect to /lost+found? yes + +Inode 29 ref count is 2, should be 1. Fix? yes + +Unattached inode 30 +Connect to /lost+found? yes + +Inode 30 ref count is 2, should be 1. Fix? yes + +Unattached inode 31 +Connect to /lost+found? yes + +Inode 31 ref count is 2, should be 1. Fix? yes + +Unattached inode 32 +Connect to /lost+found? yes + +Inode 32 ref count is 2, should be 1. Fix? yes + +Unattached inode 33 +Connect to /lost+found? yes + +Inode 33 ref count is 2, should be 1. Fix? yes + +Unattached inode 34 +Connect to /lost+found? yes + +Inode 34 ref count is 2, should be 1. Fix? yes + +Unattached inode 35 +Connect to /lost+found? yes + +Inode 35 ref count is 2, should be 1. Fix? yes + +Unattached inode 36 +Connect to /lost+found? yes + +Inode 36 ref count is 2, should be 1. Fix? yes + +Unattached inode 37 +Connect to /lost+found? yes + +Inode 37 ref count is 2, should be 1. Fix? yes + +Unattached inode 38 +Connect to /lost+found? yes + +Inode 38 ref count is 2, should be 1. Fix? yes + +Unattached inode 39 +Connect to /lost+found? yes + +Inode 39 ref count is 2, should be 1. Fix? yes + +Unattached inode 40 +Connect to /lost+found? yes + +Inode 40 ref count is 2, should be 1. Fix? yes + +Unattached inode 41 +Connect to /lost+found? yes + +Inode 41 ref count is 2, should be 1. Fix? yes + +Unattached inode 42 +Connect to /lost+found? yes + +Inode 42 ref count is 2, should be 1. Fix? yes + +Unattached inode 43 +Connect to /lost+found? yes + +Inode 43 ref count is 2, should be 1. Fix? yes + +Unattached inode 44 +Connect to /lost+found? yes + +Inode 44 ref count is 2, should be 1. Fix? yes + +Unattached inode 45 +Connect to /lost+found? yes + +Inode 45 ref count is 2, should be 1. Fix? yes + +Unattached inode 46 +Connect to /lost+found? yes + +Inode 46 ref count is 2, should be 1. Fix? yes + +Unattached inode 47 +Connect to /lost+found? yes + +Inode 47 ref count is 2, should be 1. Fix? yes + +Unattached inode 48 +Connect to /lost+found? yes + +Inode 48 ref count is 2, should be 1. Fix? yes + +Unattached inode 49 +Connect to /lost+found? yes + +Inode 49 ref count is 2, should be 1. Fix? yes + +Unattached inode 50 +Connect to /lost+found? yes + +Inode 50 ref count is 2, should be 1. Fix? yes + +Unattached inode 51 +Connect to /lost+found? yes + +Inode 51 ref count is 2, should be 1. Fix? yes + +Unattached inode 52 +Connect to /lost+found? yes + +Inode 52 ref count is 2, should be 1. Fix? yes + +Unattached inode 53 +Connect to /lost+found? yes + +Inode 53 ref count is 2, should be 1. Fix? yes + +Unattached inode 54 +Connect to /lost+found? yes + +Inode 54 ref count is 2, should be 1. Fix? yes + +Unattached inode 55 +Connect to /lost+found? yes + +Inode 55 ref count is 2, should be 1. Fix? yes + +Unattached inode 56 +Connect to /lost+found? yes + +Inode 56 ref count is 2, should be 1. Fix? yes + +Unattached inode 57 +Connect to /lost+found? yes + +Inode 57 ref count is 2, should be 1. Fix? yes + +Unattached inode 58 +Connect to /lost+found? yes + +Inode 58 ref count is 2, should be 1. Fix? yes + +Unattached inode 59 +Connect to /lost+found? yes + +Inode 59 ref count is 2, should be 1. Fix? yes + +Unattached inode 60 +Connect to /lost+found? yes + +Inode 60 ref count is 2, should be 1. Fix? yes + +Unattached inode 61 +Connect to /lost+found? yes + +Inode 61 ref count is 2, should be 1. Fix? yes + +Unattached inode 62 +Connect to /lost+found? yes + +Inode 62 ref count is 2, should be 1. Fix? yes + +Unattached inode 63 +Connect to /lost+found? yes + +Inode 63 ref count is 2, should be 1. Fix? yes + +Unattached inode 64 +Connect to /lost+found? yes + +Inode 64 ref count is 2, should be 1. Fix? yes + +Unattached zero-length inode 65. Clear? yes + +Unattached inode 66 +Connect to /lost+found? yes + +Inode 66 ref count is 2, should be 1. Fix? yes + +Unattached inode 67 +Connect to /lost+found? yes + +Inode 67 ref count is 2, should be 1. Fix? yes + +Pass 5: Checking group summary information + +test_filesys: ***** FILE SYSTEM WAS MODIFIED ***** +test_filesys: 67/512 files (1.5% non-contiguous), 1127/2048 blocks +Exit status is 1 diff --git a/tests/f_rebuild_csum_rootdir/expect.2 b/tests/f_rebuild_csum_rootdir/expect.2 new file mode 100644 index 0000000..033f1bf --- /dev/null +++ b/tests/f_rebuild_csum_rootdir/expect.2 @@ -0,0 +1,7 @@ +Pass 1: Checking inodes, blocks, and sizes +Pass 2: Checking directory structure +Pass 3: Checking directory connectivity +Pass 4: Checking reference counts +Pass 5: Checking group summary information +test_filesys: 67/512 files (1.5% non-contiguous), 1127/2048 blocks +Exit status is 0 diff --git a/tests/f_rebuild_csum_rootdir/image.gz b/tests/f_rebuild_csum_rootdir/image.gz new file mode 100644 index 0000000000000000000000000000000000000000..a32fd4431a44560b20033d43836000ef22ce977f GIT binary patch literal 12476 zcmeI2c~leUyT@t$QMaFB>q3zwwrWuk5Ktr{q?HOkRKy~R2oeP}Dq@f&VRc#;a6z#s zrpl69L{tz2#3&I4TtEa8ma;FSr9dEopd+ba_$YR?N_+<)}zf`To5 z=hb$P-kkHF`HVWm`KluLK6~u-bcIqdR9ibDd9NH992~rn;rhk?^7~s8DqO8i9iH5G zbTwI3I@!Bs+3X;vX#e`4%+zo0IIWB#)puBeJ>5bO@g0*d-aQQe^5?moSuer{AFys?L8)aG_kI{eJy^)P zyT8XU=k4shrP+9NwN81tFNv)(=H1H!mgoJP2cHO%ch#7zGPbpr$L9Nrqg?{@baZrj z7=DQ5$~mJa>EDrpV>9Wm*tcinA`+HmmArRVmgyjicYCcr`AoB!{-=C;#g%1~!(FiP zSW-xA_nO{mbkOmx6f7yFD<_KjIAI2S3@Tv&g0i>y-OR|18&;2&WoE5M#^Z<9AJmLF z^ehjUPY>zoJSv5)#RD3j(mLTd>GrTDx=P+^pOMRdcD%G#oX3w9sV^saD<@odu06UR8_0+X*{@-rkd%)I-$zb$K3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uild_csum_rootdir/name new file mode 100644 index 0000000..b246f48 --- /dev/null +++ b/tests/f_rebuild_csum_rootdir/name @@ -0,0 +1 @@ +force fsck to rebuild a corrupted rootdir w/ metadata_csum