Whamcloud - gitweb
resize2fs: update sb journal backup if journal was moved
authorEric Sandeen <sandeen@redhat.com>
Thu, 18 Jun 2009 01:55:39 +0000 (20:55 -0500)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 18 Jun 2009 11:47:54 +0000 (07:47 -0400)
commit8a6ede8b7a8d5be0d49d6bfa7616537b61dfdc1b
treefc506898f6e97571c23fbdf836fbe9c39db6862a
parent827c1887118eb68a64f8455d0b7cbbbed65e714a
resize2fs: update sb journal backup if journal was moved

This was reported in Fedora, since the livecd creator does
a lot of resizing.

If we've moved the journal blocks during resize (more likely now,
due to the journal being in the middle) the backup blocks in the
superblock don't get updated, and a subsequent e2fsck will find
issues:

e2fsck 1.41.6 (30-May-2009)
Backing up journal inode block information.

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

/mnt/test/img: ***** FILE SYSTEM WAS MODIFIED *****
/mnt/test/img: 11/16000 files (0.0% non-contiguous), 17789/38400 blocks

This can be shown in a simple test:

# dd if=/dev/zero of=img bs=1 count=0 seek=3000M
# mke2fs -t ext4 -F img
# resize2fs img 150M
# e2fsck -f img

(thanks to the Fedora reporter Mads Kiilerich for the testcase!
https://bugzilla.redhat.com/show_bug.cgi?id=506105#c2)

So, update the backup journal in the superblock before resize2fs exits.

Addresses-RedHat-Bugzilla: #505339

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
resize/resize2fs.c