diff mbox

[13/37] e2fsck: write dir blocks after new inode when reconstructing root/lost+found

Message ID 20140501231347.31890.92245.stgit@birch.djwong.org
State Superseded, archived
Headers show

Commit Message

Darrick Wong May 1, 2014, 11:13 p.m. UTC
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.
Add a regression test while we're at it.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 e2fsck/pass3.c                        |   85 +++++----
 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 
 5 files changed, 364 insertions(+), 40 deletions(-)
 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

Comments

Lukas Czerner May 5, 2014, 5:13 p.m. UTC | #1
On Thu, 1 May 2014, Darrick J. Wong wrote:

> Date: Thu, 01 May 2014 16:13:47 -0700
> From: Darrick J. Wong <darrick.wong@oracle.com>
> To: tytso@mit.edu, darrick.wong@oracle.com
> Cc: linux-ext4@vger.kernel.org
> Subject: [PATCH 13/37] e2fsck: write dir blocks after new inode when
>     reconstructing root/lost+found
> 
> 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.
> Add a regression test while we're at it.

Looks good, but might be worth noting in description that it also fixes
possible memory leak in check_root()

Reviewed-by: Lukas Czerner <lczerner@redhat.com>

> 
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
>  e2fsck/pass3.c                        |   85 +++++----
>  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 
>  5 files changed, 364 insertions(+), 40 deletions(-)
>  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
> 
> 
> diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c
> index 6f7f855..efc0d49 100644
> --- a/e2fsck/pass3.c
> +++ b/e2fsck/pass3.c
> @@ -188,28 +188,6 @@ static void check_root(e2fsck_t ctx)
>  	ext2fs_mark_bb_dirty(fs);
>  
>  	/*
> -	 * Now let's create the actual data block for the inode
> -	 */
> -	pctx.errcode = ext2fs_new_dir_block(fs, EXT2_ROOT_INO, EXT2_ROOT_INO,
> -					    &block);
> -	if (pctx.errcode) {
> -		pctx.str = "ext2fs_new_dir_block";
> -		fix_problem(ctx, PR_3_CREATE_ROOT_ERROR, &pctx);
> -		ctx->flags |= E2F_FLAG_ABORT;
> -		return;
> -	}
> -
> -	pctx.errcode = ext2fs_write_dir_block4(fs, blk, block, 0,
> -					       EXT2_ROOT_INO);
> -	if (pctx.errcode) {
> -		pctx.str = "ext2fs_write_dir_block4";
> -		fix_problem(ctx, PR_3_CREATE_ROOT_ERROR, &pctx);
> -		ctx->flags |= E2F_FLAG_ABORT;
> -		return;
> -	}
> -	ext2fs_free_mem(&block);
> -
> -	/*
>  	 * Set up the inode structure
>  	 */
>  	memset(&inode, 0, sizeof(inode));
> @@ -232,6 +210,30 @@ static void check_root(e2fsck_t ctx)
>  	}
>  
>  	/*
> +	 * Now let's create the actual data block for the inode.
> +	 * Due to metadata_csum, we must write the dir blocks AFTER
> +	 * the inode has been written to disk!
> +	 */
> +	pctx.errcode = ext2fs_new_dir_block(fs, EXT2_ROOT_INO, EXT2_ROOT_INO,
> +					    &block);
> +	if (pctx.errcode) {
> +		pctx.str = "ext2fs_new_dir_block";
> +		fix_problem(ctx, PR_3_CREATE_ROOT_ERROR, &pctx);
> +		ctx->flags |= E2F_FLAG_ABORT;
> +		return;
> +	}
> +
> +	pctx.errcode = ext2fs_write_dir_block4(fs, blk, block, 0,
> +					       EXT2_ROOT_INO);
> +	ext2fs_free_mem(&block);
> +	if (pctx.errcode) {
> +		pctx.str = "ext2fs_write_dir_block4";
> +		fix_problem(ctx, PR_3_CREATE_ROOT_ERROR, &pctx);
> +		ctx->flags |= E2F_FLAG_ABORT;
> +		return;
> +	}
> +
> +	/*
>  	 * Miscellaneous bookkeeping...
>  	 */
>  	e2fsck_add_dir_info(ctx, EXT2_ROOT_INO, EXT2_ROOT_INO);
> @@ -449,24 +451,6 @@ unlink:
>  	ext2fs_inode_alloc_stats2(fs, ino, +1, 1);
>  
>  	/*
> -	 * Now let's create the actual data block for the inode
> -	 */
> -	retval = ext2fs_new_dir_block(fs, ino, EXT2_ROOT_INO, &block);
> -	if (retval) {
> -		pctx.errcode = retval;
> -		fix_problem(ctx, PR_3_ERR_LPF_NEW_DIR_BLOCK, &pctx);
> -		return 0;
> -	}
> -
> -	retval = ext2fs_write_dir_block4(fs, blk, block, 0, ino);
> -	ext2fs_free_mem(&block);
> -	if (retval) {
> -		pctx.errcode = retval;
> -		fix_problem(ctx, PR_3_ERR_LPF_WRITE_BLOCK, &pctx);
> -		return 0;
> -	}
> -
> -	/*
>  	 * Set up the inode structure
>  	 */
>  	memset(&inode, 0, sizeof(inode));
> @@ -486,6 +470,27 @@ unlink:
>  		fix_problem(ctx, PR_3_CREATE_LPF_ERROR, &pctx);
>  		return 0;
>  	}
> +
> +	/*
> +	 * Now let's create the actual data block for the inode.
> +	 * Due to metadata_csum, the directory block MUST be written
> +	 * after the inode is written to disk!
> +	 */
> +	retval = ext2fs_new_dir_block(fs, ino, EXT2_ROOT_INO, &block);
> +	if (retval) {
> +		pctx.errcode = retval;
> +		fix_problem(ctx, PR_3_ERR_LPF_NEW_DIR_BLOCK, &pctx);
> +		return 0;
> +	}
> +
> +	retval = ext2fs_write_dir_block4(fs, blk, block, 0, ino);
> +	ext2fs_free_mem(&block);
> +	if (retval) {
> +		pctx.errcode = retval;
> +		fix_problem(ctx, PR_3_ERR_LPF_WRITE_BLOCK, &pctx);
> +		return 0;
> +	}
> +
>  	/*
>  	 * Finally, create the directory link
>  	 */
> 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 <The NULL inode> (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;FSr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MG*!)}IuCE$~1@R%|yO2yrO23O5dzwa?+2F9Nn~Lf?
> z*G9gW)dMWLpCJs$R!;#kpwJh?`BR;L6(HXka=g6Q5Ok><iK|cx>1u-|necLmV4#ij
> z#E5r=8v4^nO`wW3d9fZ*A1NTJ7Wq=bn?=x*NQrZlNZwy&pn8w^{xpas7eRuz5^4V*
> zD!SGgR_bD~gRXXV%Q$Md39@zuxWoTr3>wYe^agZd_AOW{_t&`7zM1rt>GGO1AlYT+
> zDsFVRf^wy+ySAnszIBG(%^J}2F)3pFJA$koqa~mvpe3Lspe3Lspe3Lspe3Lspe3Ls
> zpe3Lspe3Lspe3Lspe3Lspe3Lspe3Lspe3Lspe67(B|wQB?3U1P9P7+eL4^IM3;(9e
> W)Gq69OyI|Sozg9bf2Chr*ZB{=uW}{;
> 
> literal 0
> HcmV?d00001
> 
> diff --git a/tests/f_rebuild_csum_rootdir/name b/tests/f_rebuild_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
> 
> --
> 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
> 
--
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 mbox

Patch

diff --git a/e2fsck/pass3.c b/e2fsck/pass3.c
index 6f7f855..efc0d49 100644
--- a/e2fsck/pass3.c
+++ b/e2fsck/pass3.c
@@ -188,28 +188,6 @@  static void check_root(e2fsck_t ctx)
 	ext2fs_mark_bb_dirty(fs);
 
 	/*
-	 * Now let's create the actual data block for the inode
-	 */
-	pctx.errcode = ext2fs_new_dir_block(fs, EXT2_ROOT_INO, EXT2_ROOT_INO,
-					    &block);
-	if (pctx.errcode) {
-		pctx.str = "ext2fs_new_dir_block";
-		fix_problem(ctx, PR_3_CREATE_ROOT_ERROR, &pctx);
-		ctx->flags |= E2F_FLAG_ABORT;
-		return;
-	}
-
-	pctx.errcode = ext2fs_write_dir_block4(fs, blk, block, 0,
-					       EXT2_ROOT_INO);
-	if (pctx.errcode) {
-		pctx.str = "ext2fs_write_dir_block4";
-		fix_problem(ctx, PR_3_CREATE_ROOT_ERROR, &pctx);
-		ctx->flags |= E2F_FLAG_ABORT;
-		return;
-	}
-	ext2fs_free_mem(&block);
-
-	/*
 	 * Set up the inode structure
 	 */
 	memset(&inode, 0, sizeof(inode));
@@ -232,6 +210,30 @@  static void check_root(e2fsck_t ctx)
 	}
 
 	/*
+	 * Now let's create the actual data block for the inode.
+	 * Due to metadata_csum, we must write the dir blocks AFTER
+	 * the inode has been written to disk!
+	 */
+	pctx.errcode = ext2fs_new_dir_block(fs, EXT2_ROOT_INO, EXT2_ROOT_INO,
+					    &block);
+	if (pctx.errcode) {
+		pctx.str = "ext2fs_new_dir_block";
+		fix_problem(ctx, PR_3_CREATE_ROOT_ERROR, &pctx);
+		ctx->flags |= E2F_FLAG_ABORT;
+		return;
+	}
+
+	pctx.errcode = ext2fs_write_dir_block4(fs, blk, block, 0,
+					       EXT2_ROOT_INO);
+	ext2fs_free_mem(&block);
+	if (pctx.errcode) {
+		pctx.str = "ext2fs_write_dir_block4";
+		fix_problem(ctx, PR_3_CREATE_ROOT_ERROR, &pctx);
+		ctx->flags |= E2F_FLAG_ABORT;
+		return;
+	}
+
+	/*
 	 * Miscellaneous bookkeeping...
 	 */
 	e2fsck_add_dir_info(ctx, EXT2_ROOT_INO, EXT2_ROOT_INO);
@@ -449,24 +451,6 @@  unlink:
 	ext2fs_inode_alloc_stats2(fs, ino, +1, 1);
 
 	/*
-	 * Now let's create the actual data block for the inode
-	 */
-	retval = ext2fs_new_dir_block(fs, ino, EXT2_ROOT_INO, &block);
-	if (retval) {
-		pctx.errcode = retval;
-		fix_problem(ctx, PR_3_ERR_LPF_NEW_DIR_BLOCK, &pctx);
-		return 0;
-	}
-
-	retval = ext2fs_write_dir_block4(fs, blk, block, 0, ino);
-	ext2fs_free_mem(&block);
-	if (retval) {
-		pctx.errcode = retval;
-		fix_problem(ctx, PR_3_ERR_LPF_WRITE_BLOCK, &pctx);
-		return 0;
-	}
-
-	/*
 	 * Set up the inode structure
 	 */
 	memset(&inode, 0, sizeof(inode));
@@ -486,6 +470,27 @@  unlink:
 		fix_problem(ctx, PR_3_CREATE_LPF_ERROR, &pctx);
 		return 0;
 	}
+
+	/*
+	 * Now let's create the actual data block for the inode.
+	 * Due to metadata_csum, the directory block MUST be written
+	 * after the inode is written to disk!
+	 */
+	retval = ext2fs_new_dir_block(fs, ino, EXT2_ROOT_INO, &block);
+	if (retval) {
+		pctx.errcode = retval;
+		fix_problem(ctx, PR_3_ERR_LPF_NEW_DIR_BLOCK, &pctx);
+		return 0;
+	}
+
+	retval = ext2fs_write_dir_block4(fs, blk, block, 0, ino);
+	ext2fs_free_mem(&block);
+	if (retval) {
+		pctx.errcode = retval;
+		fix_problem(ctx, PR_3_ERR_LPF_WRITE_BLOCK, &pctx);
+		return 0;
+	}
+
 	/*
 	 * Finally, create the directory link
 	 */
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 <The NULL inode> (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<uln0fBld(XM|o_o$czd!p&@=tP}yz|cc
zeBS5%exEsK7#C;g9HESNemYIjJ@bmu!CU3;GrDISaQ)YkC7*op=Y<*7pKbba-qmkE
z{p=r`FV7KVy-rRy3bf?&zWaXpYvZqH{p0*kI-Bftzdp6>+ba_$YR?N_+<)}zf`To5
z=hb$P-kkHF`HVWm`KluLK6~u-bcIqdR9ibDd9NH992~rn;rhk?^7~s8DqO8i9iH5G
zbTwI3I@!Bs+3X;vX#e`4%+zo0IIWB#)puBe<k4)1jR@a~ZElv_JmzO_wa#H8NfkT$
zv*p#67WPB&=KV$mH4)-VMq?elNFE}uYs-01N_4+AeAe?m#pQuxWM!6(s7&6qu=g8u
zDwWuhHCTP6qz5~DIUa2>J>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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