diffstat for e2fsprogs-1.43.4 e2fsprogs-1.43.4 changelog | 10 + patches/0001-resize2fs-update-checksums-in-the-extent-tree-s-relo.patch | 98 ++++++++++ patches/series | 1 rules | 5 4 files changed, 111 insertions(+), 3 deletions(-) diff -Nru e2fsprogs-1.43.4/debian/changelog e2fsprogs-1.43.4/debian/changelog --- e2fsprogs-1.43.4/debian/changelog 2017-02-01 00:54:55.000000000 +0000 +++ e2fsprogs-1.43.4/debian/changelog 2019-04-25 11:10:49.000000000 +0000 @@ -1,3 +1,13 @@ +e2fsprogs (1.43.4-2endless1) eos3.5; urgency=medium + + * d/patches/0001-resize2fs-update-checksums-in-the-extent-tree-s-relo.patch: + Fix issue with resize2fs extent checksums after shrinking filesystems. + (T25168) + * debian/rules: Backport fix that strips removed packages such as + libblkid1-udeb that newer debhelper errors on. + + -- Dan Nicholson Thu, 25 Apr 2019 06:10:49 -0500 + e2fsprogs (1.43.4-2) unstable; urgency=medium * Re-enable metadata_csum for Debian (which was accidentally disabled diff -Nru e2fsprogs-1.43.4/debian/patches/0001-resize2fs-update-checksums-in-the-extent-tree-s-relo.patch e2fsprogs-1.43.4/debian/patches/0001-resize2fs-update-checksums-in-the-extent-tree-s-relo.patch --- e2fsprogs-1.43.4/debian/patches/0001-resize2fs-update-checksums-in-the-extent-tree-s-relo.patch 1970-01-01 00:00:00.000000000 +0000 +++ e2fsprogs-1.43.4/debian/patches/0001-resize2fs-update-checksums-in-the-extent-tree-s-relo.patch 2019-04-25 10:43:17.000000000 +0000 @@ -0,0 +1,98 @@ +From 4b3038134baf81c6f9bd36dbbf565ea66e46331f Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Sat, 20 Oct 2018 09:14:48 -0400 +Subject: [PATCH] resize2fs: update checksums in the extent tree's relocated + block + +When shrinking an file system, and we need to relocate an inode, the +checksums in its extent tree must get updated to reflect its new inode +number. When doing this, we need to do this *after* we update the +extent tree to reflect any blocks which need to be relocated due to +the file system shrink operation. + +Otherwise, in the case where only an interior node of the extent tree +needs to get relocated, and none of the entries in that node need to +be adjusted, the checksum for that interior node is updated in the old +copy of that block, and then after the extent tree is updated to use +the new copy of that interior node, the extent tree is left with an +invalid checksum. + +This is a relatively rare case, since it requires the following +conditions to be true: + +*) The metadata checksum feature must be enabled. +*) An inode needs to be relocated. +*) The inode needs to have an interior node. +*) The block for that interior node needs to be relocated. +*) None of blocks addressed by entries in that interior node needs + to be relocated. + +When all of these conditions are true, though, the file system is left +with corrupted with bad checksum for the extent tree block. + +Addresses-Launchpad-Bug: 1798562 + +Signed-off-by: Theodore Ts'o +Reported-by: Jean-Baptiste Lallement +--- + resize/resize2fs.c | 22 ++++++++++------------ + 1 file changed, 10 insertions(+), 12 deletions(-) + +Index: e2fsprogs-1.43.4/resize/resize2fs.c +=================================================================== +--- e2fsprogs-1.43.4.orig/resize/resize2fs.c ++++ e2fsprogs-1.43.4/resize/resize2fs.c +@@ -2094,31 +2094,20 @@ remap_blocks: + if (retval) + goto errout; + +- /* Rewrite extent block checksums with new inode number */ +- if (ext2fs_has_feature_metadata_csum(rfs->old_fs->super) && +- (inode->i_flags & EXT4_EXTENTS_FL)) { +- rfs->old_fs->flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS; +- retval = rewrite_extents(rfs->old_fs, new_inode); +- rfs->old_fs->flags &= ~EXT2_FLAG_IGNORE_CSUM_ERRORS; +- if (retval) +- goto errout; +- } +- + /* + * Update inodes to point to new blocks; schedule directory + * blocks for inode remapping. Need to write out dir blocks + * with new inode numbers if we have metadata_csum enabled. + */ ++ rfs->old_fs->flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS; + if (ext2fs_inode_has_valid_blocks2(rfs->old_fs, inode) && + (rfs->bmap || pb.is_dir)) { + pb.ino = new_inode; + pb.old_ino = ino; + pb.has_extents = inode->i_flags & EXT4_EXTENTS_FL; +- rfs->old_fs->flags |= EXT2_FLAG_IGNORE_CSUM_ERRORS; + retval = ext2fs_block_iterate3(rfs->old_fs, + new_inode, 0, block_buf, + process_block, &pb); +- rfs->old_fs->flags &= ~EXT2_FLAG_IGNORE_CSUM_ERRORS; + if (retval) + goto errout; + if (pb.error) { +@@ -2133,11 +2122,20 @@ remap_blocks: + if (retval) + goto errout; + } ++ ++ /* Fix up extent block checksums with the new inode number */ ++ if (ext2fs_has_feature_metadata_csum(rfs->old_fs->super) && ++ (inode->i_flags & EXT4_EXTENTS_FL)) { ++ retval = rewrite_extents(rfs->old_fs, new_inode); ++ if (retval) ++ goto errout; ++ } + } + io_channel_flush(rfs->old_fs->io); + + errout: + reset_com_err_hook(); ++ rfs->old_fs->flags &= ~EXT2_FLAG_IGNORE_CSUM_ERRORS; + if (rfs->bmap) { + ext2fs_free_extent_table(rfs->bmap); + rfs->bmap = 0; diff -Nru e2fsprogs-1.43.4/debian/patches/series e2fsprogs-1.43.4/debian/patches/series --- e2fsprogs-1.43.4/debian/patches/series 2017-02-01 00:54:55.000000000 +0000 +++ e2fsprogs-1.43.4/debian/patches/series 2019-04-25 10:42:43.000000000 +0000 @@ -1,2 +1,3 @@ e2fsprogs-1.43.4-release-fixup enable-metadata_csum-by-default +0001-resize2fs-update-checksums-in-the-extent-tree-s-relo.patch diff -Nru e2fsprogs-1.43.4/debian/rules e2fsprogs-1.43.4/debian/rules --- e2fsprogs-1.43.4/debian/rules 2016-09-02 04:52:46.000000000 +0000 +++ e2fsprogs-1.43.4/debian/rules 2019-04-25 11:10:16.000000000 +0000 @@ -542,7 +542,7 @@ ${debdir}/libblkid${BLKID_SOVERSION}/usr/share/doc/libblkid${BLKID_SOVERSION}/copyright endif - dh_installdocs -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb + dh_installdocs -Ne2fsprogs-udeb # HTML docs $(INSTALL) -d ${debdir}/e2fslibs-dev/usr/share/doc/e2fslibs/html-info/ @@ -623,8 +623,7 @@ -u"-Ldebian/e2fsprogs.shlibs.local" endif - dh_gencontrol -Ncomerr-dev -Nss-dev -Nuuid-dev \ - -Ne2fsprogs-udeb -Nlibblkid1-udeb -Nlibuuid1-udeb + dh_gencontrol -Ncomerr-dev -Nss-dev -Ne2fsprogs-udeb DH_OPTIONS= dh_gencontrol -pcomerr-dev \ -u '-v${COMERR_VERSION}-${MAIN_VERSION} -VmainBinary=${MAIN_VERSION}' DH_OPTIONS= dh_gencontrol -pss-dev \