summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--e2fsprogs-1.41.4-extent-open-leak.patch28
-rw-r--r--e2fsprogs-1.41.4-update-sb-journal-backup.patch89
-rw-r--r--e2fsprogs.spec14
-rwxr-xr-xuuidd.init2
4 files changed, 131 insertions, 2 deletions
diff --git a/e2fsprogs-1.41.4-extent-open-leak.patch b/e2fsprogs-1.41.4-extent-open-leak.patch
new file mode 100644
index 0000000..8d4112b
--- /dev/null
+++ b/e2fsprogs-1.41.4-extent-open-leak.patch
@@ -0,0 +1,28 @@
+Each time an extent handle is opened and closed, if the inode has an
+extent tree which does not fit in the inode's i_block structure, a
+filesystem block buffer was not getting released. Since e2fsck opens
+an extent handle for every inode using extents, this can translate to
+a very large amount of memory getting lost.
+
+Thanks to Henrik 'Mauritz' Johnson for discovering and pointing out
+this leak, which he ran into while running the "rdump" command in
+debugfs.
+
+Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
+---
+ lib/ext2fs/extent.c | 2 +-
+ 1 files changed, 1 insertions(+), 1 deletions(-)
+
+diff --git a/lib/ext2fs/extent.c b/lib/ext2fs/extent.c
+index b7eb617..2b88739 100644
+--- a/lib/ext2fs/extent.c
++++ b/lib/ext2fs/extent.c
+@@ -168,7 +168,7 @@ extern void ext2fs_extent_free(ext2_extent_handle_t handle)
+ if (handle->inode)
+ ext2fs_free_mem(&handle->inode);
+ if (handle->path) {
+- for (i=1; i < handle->max_depth; i++) {
++ for (i=1; i <= handle->max_depth; i++) {
+ if (handle->path[i].buf)
+ ext2fs_free_mem(&handle->path[i].buf);
+ }
diff --git a/e2fsprogs-1.41.4-update-sb-journal-backup.patch b/e2fsprogs-1.41.4-update-sb-journal-backup.patch
new file mode 100644
index 0000000..1f26210
--- /dev/null
+++ b/e2fsprogs-1.41.4-update-sb-journal-backup.patch
@@ -0,0 +1,89 @@
+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.
+
+Signed-off-by: Eric Sandeen <sandeen@redhat.com>
+Resolves-RH-Bugzilla: 505339
+---
+
+diff --git a/resize/resize2fs.c b/resize/resize2fs.c
+index 0d5dc81..63c469f 100644
+--- a/resize/resize2fs.c
++++ b/resize/resize2fs.c
+@@ -49,6 +49,7 @@ static errcode_t inode_ref_fix(ext2_resize_t rfs);
+ static errcode_t move_itables(ext2_resize_t rfs);
+ static errcode_t fix_resize_inode(ext2_filsys fs);
+ static errcode_t ext2fs_calculate_summary_stats(ext2_filsys fs);
++static errcode_t fix_sb_journal_backup(ext2_filsys fs);
+
+ /*
+ * Some helper CPP macros
+@@ -148,6 +149,10 @@ errcode_t resize_fs(ext2_filsys fs, blk_t *new_size, int flags,
+ if (retval)
+ goto errout;
+
++ retval = fix_sb_journal_backup(rfs->new_fs);
++ if (retval)
++ goto errout;
++
+ rfs->new_fs->flags &= ~EXT2_FLAG_MASTER_SB_ONLY;
+ retval = ext2fs_close(rfs->new_fs);
+ if (retval)
+@@ -1857,6 +1862,28 @@ static errcode_t ext2fs_calculate_summary_stats(ext2_filsys fs)
+ }
+
+ /*
++ * Journal may have been relocated; update the backup journal blocks
++ * in the superblock.
++ */
++static errcode_t fix_sb_journal_backup(ext2_filsys fs)
++{
++ errcode_t retval;
++ struct ext2_inode inode;
++
++ if (!(fs->super->s_feature_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL))
++ return 0;
++
++ retval = ext2fs_read_inode(fs, fs->super->s_journal_inum, &inode);
++ if (retval)
++ return retval;
++ memcpy(fs->super->s_jnl_blocks, inode.i_block, EXT2_N_BLOCKS*4);
++ fs->super->s_jnl_blocks[16] = inode.i_size;
++ fs->super->s_jnl_backup_type = EXT3_JNL_BACKUP_BLOCKS;
++ ext2fs_mark_super_dirty(fs);
++ return 0;
++}
++
++/*
+ * calcluate the minimum number of blocks the given fs can be resized to
+ */
+ blk_t calculate_minimum_resize_size(ext2_filsys fs)
+
diff --git a/e2fsprogs.spec b/e2fsprogs.spec
index 1e92fea..ee45b43 100644
--- a/e2fsprogs.spec
+++ b/e2fsprogs.spec
@@ -4,7 +4,7 @@
Summary: Utilities for managing ext2, ext3, and ext4 filesystems
Name: e2fsprogs
Version: 1.41.4
-Release: 10%{?dist}
+Release: 11%{?dist}
# License based on upstream-modified COPYING file,
# which clearly states "V2" intent.
License: GPLv2
@@ -15,6 +15,8 @@ Source2: blkid_types-wrapper.h
Source3: uuidd.init
Patch1: e2fsprogs-1.38-etcblkid.patch
Patch2: e2fsprogs-1.40.4-sb_feature_check_ignore.patch
+
+# These are all upstream, or headed there.
Patch3: e2fsprogs-1.41.4-debugfs-stat-segfault.patch
Patch4: e2fsprogs-1.41.4-libext2fs-info.patch
Patch5: e2fsprogs-1.41.4-fix-blkid-segfault.patch
@@ -23,6 +25,8 @@ Patch7: e2fsprogs-1.41.4-ext4-resize-fixes.patch
Patch8: e2fsprogs-1.41.4-fix-external-journals.patch
Patch9: e2fsprogs-1.41.4-i_file_acl_high-fix.patch
Patch10: e2fsprogs-1.41.4-minimum-resize.patch
+Patch11: e2fsprogs-1.41.4-update-sb-journal-backup.patch
+Patch12: e2fsprogs-1.41.4-extent-open-leak.patch
Url: http://e2fsprogs.sourceforge.net/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@@ -116,6 +120,10 @@ SMP systems.
%patch9 -p1 -b .acl_hi
# Fix minimum resize calculation and enforce it
%patch10 -p1 -b .resize_min
+# Update sb journal backup blocks on resize
+%patch11 -p1 -b .resize_sb_backup
+# Fix memory leak in extent handling
+%patch12 -p1 -b .extent_leak
%build
%configure --enable-elf-shlibs --enable-nls --disable-e2initrd-helper --enable-blkid-devmapper --enable-blkid-selinux
@@ -314,6 +322,10 @@ fi
%dir %attr(2775, uuidd, uuidd) /var/lib/libuuid
%changelog
+* Thu Jun 18 2009 Eric Sandeen <sandeen@redhat.com> 1.41.4-11
+- Update journal backup blocks in sb after resize (#505339)
+- Fix memory leak in extent handling functions
+
* Wed May 20 2009 Eric Sandeen <sandeen@redhat.com> 1.41.4-10
- Fix minimum resize calculation and enforce it (#499452)
diff --git a/uuidd.init b/uuidd.init
index e269da8..9aca1da 100755
--- a/uuidd.init
+++ b/uuidd.init
@@ -65,7 +65,7 @@ case "$1" in
;;
status)
status -p /var/lib/libuuid/uuidd.pid uuidd uuidd
- REVAL=$?
+ RETVAL=$?
;;
*)
echo $"Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart}"