]> git.ipfire.org Git - thirdparty/e2fsprogs.git/commitdiff
e2fsck: allow verity files to have initialized blocks past i_size
authorEric Biggers <ebiggers@google.com>
Tue, 21 Aug 2018 17:59:37 +0000 (10:59 -0700)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 21 Aug 2018 19:18:25 +0000 (15:18 -0400)
Since ext4 verity is going to be an RO_COMPAT feature rather than an
INCOMPAT one, the on-disk i_size of verity inodes needs to be the data
size rather than the full size.  Consequently, verity inodes will have
initialized blocks past i_size, containing the Merkle tree and other
verity metadata.  So e2fsck must not fix the i_size of such inodes as it
normally would.

Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
e2fsck/pass1.c

index ce43821dc3a49840ce83eec16632d6ae980befe0..8abf0c33a1d365651a3fef5ddfd36612ee65e0e1 100644 (file)
@@ -3447,7 +3447,8 @@ static void check_blocks(e2fsck_t ctx, struct problem_context *pctx,
                size = EXT2_I_SIZE(inode);
                if ((pb.last_init_lblock >= 0) &&
                    /* Do not allow initialized allocated blocks past i_size*/
-                   (size < (__u64)pb.last_init_lblock * fs->blocksize))
+                   (size < (__u64)pb.last_init_lblock * fs->blocksize) &&
+                   !(inode->i_flags & EXT4_VERITY_FL))
                        bad_size = 3;
                else if (!(extent_fs && (inode->i_flags & EXT4_EXTENTS_FL)) &&
                         size > ext2_max_sizes[fs->super->s_log_block_size])