* Wed Feb 10 2010 Eric Sandeen <sandeen@redhat.com> 1.41.10-1

- New upstream version
This commit is contained in:
Eric Sandeen 2010-02-10 23:21:56 +00:00
parent 64027e375c
commit c23cb71590
11 changed files with 7 additions and 2141 deletions

View File

@ -1 +1 @@
e2fsprogs-1.41.9.tar.gz
e2fsprogs-1.41.10.tar.gz

View File

@ -1,199 +0,0 @@
From ba5131f6d48eded504e84c2a8ffc8131df8a512e Mon Sep 17 00:00:00 2001
From: Theodore Ts'o <tytso@mit.edu>
Date: Fri, 16 Oct 2009 20:46:45 -0400
Subject: [PATCH] e2fsck: Accept superblock times to be fudged by up to 24 hours by default
Unfortunately, due to Windows' unfortunate design decision to
configure the hardware clock to tick localtime, instead of the more
proper and less error-prone UTC time, many users end up in the
situation where the system clock is incorrectly set at the time when
e2fsck is run.
Historically this was usually due to some distributions having buggy
init scripts and/or installers that didn't correctly detect this case
and take appropriate countermeasures. However, it's still possible,
despite the best efforts of init script and installer authors to not
be able to detect this misconfiguration, usually due to a buggy or
misconfigured virtualization manager or the installer not having
access to a network time server during the installation process. So
by default, we allow the superblock times to be fudged by up to 24
hours. This can be disabled by setting options.accept_time_fudge to
the boolean value of false in e2fsck.conf. The old
options.buggy_init_scripts is left for backwards compatibility.
Since we are now accepting the 24 hour time fudge by default, there is
no longer a need to install an Ubuntu-specific e2fsck.conf file, so we
can remove it.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
debian/rules | 6 ------
e2fsck/e2fsck.conf.5.in | 36 ++++++++++++++++++++++--------------
e2fsck/e2fsck.conf.ubuntu | 2 --
e2fsck/problem.c | 4 ++--
e2fsck/super.c | 42 ++++++++++++++++++++++++------------------
5 files changed, 48 insertions(+), 42 deletions(-)
delete mode 100644 e2fsck/e2fsck.conf.ubuntu
diff --git a/debian/rules b/debian/rules
index f62e86f..f658bd1 100755
--- a/debian/rules
+++ b/debian/rules
@@ -445,12 +445,6 @@ endif
$(INSTALL) -p -m 0644 debugfs/debug_cmds.ct \
${debdir}/ss-dev/usr/share/doc/libss${SS_SOVERSION}/examples
- if test -f /etc/lsb-release && \
- grep -q DISTRIB_ID=Ubuntu /etc/lsb-release; then \
- $(INSTALL) -p -m 0644 e2fsck/e2fsck.conf.ubuntu \
- ${debdir}/e2fsprogs/etc/e2fsck.conf; \
- fi
-
dh_installinfo -pcomerr-dev ${stdbuilddir}/lib/et/com_err.info
dh_installinfo -pe2fslibs-dev ${stdbuilddir}/doc/libext2fs.info
diff --git a/e2fsck/e2fsck.conf.5.in b/e2fsck/e2fsck.conf.5.in
index 6638a39..a5021bd 100644
--- a/e2fsck/e2fsck.conf.5.in
+++ b/e2fsck/e2fsck.conf.5.in
@@ -87,19 +87,27 @@ interrupts e2fsck using ^C, and the filesystem is not explicitly flagged
as containing errors, e2fsck will exit with an exit status of 0 instead
of 32. This setting defaults to false.
.TP
-.I buggy_init_scripts
-Some buggy distributions (such as Ubuntu) have init scripts and/or
-installers which fail to correctly set the system clock before running
-e2fsck and/or formatting the filesystem initially. Normally this
-happens because the hardware clock is ticking localtime, instead of the
-more proper and less error-prone UTC time. So while the kernel is
-booting, the system time (which in Linux systems always ticks in UTC
-time) is set from the hardware clock, but since the hardware clock is
-ticking localtime, the system time is incorrect. Unfortunately, some
-buggy distributions do not correct this before running e2fsck. If this
-option is set to a boolean value of true, we attempt to work around this
-situation by allowing the superblock last write time, last mount time,
-and last check time to be in the future by up to 24 hours.
+.I accept_time_fudge
+Unfortunately, due to Windows' unfortunate design decision
+to configure the hardware clock to tick localtime, instead
+of the more proper and less error-prone UTC time, many
+users end up in the situation where the system clock is
+incorrectly set at the time when e2fsck is run.
+.IP
+Historically this was usually due to some distributions
+having buggy init scripts and/or installers that didn't
+correctly detect this case and take appropriate
+countermeasures. However, it's still possible, despite the
+best efforts of init script and installer authors to not be
+able to detect this misconfiguration, usually due to a
+buggy or misconfigured virtualization manager or the
+installer not having access to a network time server
+during the installation process. So by default, we allow
+the superblock times to be fudged by up to 24 hours.
+This can be disabled by setting
+.I accept_time_fudge
+to the
+boolean value of false. This setting defaults to true.
.TP
.I clear_test_fs_flag
This boolean relation controls whether or not
@@ -111,7 +119,7 @@ defaults to true.
.I defer_check_on_battery
This boolean relation controls whether or not the interval between
filesystem checks (either based on time or number of mounts) should
-be doubled if the system is running on battery. It defaults to
+be doubled if the system is running on battery. This setting defaults to
true.
.TP
.I indexed_dir_slack_percentage
diff --git a/e2fsck/e2fsck.conf.ubuntu b/e2fsck/e2fsck.conf.ubuntu
deleted file mode 100644
index 49d6d19..0000000
--- a/e2fsck/e2fsck.conf.ubuntu
+++ /dev/null
@@ -1,2 +0,0 @@
-[options]
- buggy_init_scripts = 1
diff --git a/e2fsck/problem.c b/e2fsck/problem.c
index 540ac91..a713f1b 100644
--- a/e2fsck/problem.c
+++ b/e2fsck/problem.c
@@ -388,13 +388,13 @@ static struct e2fsck_problem problem_table[] = {
/* Last mount time is in the future (fudged) */
{ PR_0_FUTURE_SB_LAST_MOUNT_FUDGED,
N_("@S last mount time is in the future.\n\t(by less than a day, "
- "probably due to buggy init scripts) "),
+ "probably due to the hardware clock being incorrectly set) "),
PROMPT_FIX, PR_PREEN_OK | PR_NO_OK },
/* Last write time is in the future (fudged) */
{ PR_0_FUTURE_SB_LAST_WRITE_FUDGED,
N_("@S last write time is in the future.\n\t(by less than a day, "
- "probably due to buggy init scripts). "),
+ "probably due to the hardware clock being incorrectly set). "),
PROMPT_FIX, PR_PREEN_OK | PR_NO_OK },
/* Block group checksum (latch question) is invalid. */
diff --git a/e2fsck/super.c b/e2fsck/super.c
index c946664..951f6db 100644
--- a/e2fsck/super.c
+++ b/e2fsck/super.c
@@ -463,7 +463,7 @@ void check_super_block(e2fsck_t ctx)
int inodes_per_block;
int ipg_max;
int inode_size;
- int buggy_init_scripts;
+ int accept_time_fudge;
dgrp_t i;
blk_t should_be;
struct problem_context pctx;
@@ -795,25 +795,31 @@ void check_super_block(e2fsck_t ctx)
}
/*
- * Some buggy distributions (such as Ubuntu) have init scripts
- * and/or installers which fail to correctly set the system
- * clock before running e2fsck and/or formatting the
- * filesystem initially. Normally this happens because the
- * hardware clock is ticking localtime, instead of the more
- * proper and less error-prone UTC time. So while the kernel
- * is booting, the system time (which in Linux systems always
- * ticks in UTC time) is set from the hardware clock, but
- * since the hardware clock is ticking localtime, the system
- * time is incorrect. Unfortunately, some buggy distributions
- * do not correct this before running e2fsck. If this option
- * is set to a boolean value of true, we attempt to work
- * around this situation by allowing the superblock last write
- * time, last mount time, and last check time to be in the
- * future by up to 24 hours.
+ * Unfortunately, due to Windows' unfortunate design decision
+ * to configure the hardware clock to tick localtime, instead
+ * of the more proper and less error-prone UTC time, many
+ * users end up in the situation where the system clock is
+ * incorrectly set at the time when e2fsck is run.
+ *
+ * Historically this was usually due to some distributions
+ * having buggy init scripts and/or installers that didn't
+ * correctly detect this case and take appropriate
+ * countermeasures. However, it's still possible, despite the
+ * best efforts of init script and installer authors to not be
+ * able to detect this misconfiguration, usually due to a
+ * buggy or misconfigured virtualization manager or the
+ * installer not having access to a network time server during
+ * the installation process. So by default, we allow the
+ * superblock times to be fudged by up to 24 hours. This can
+ * be disabled by setting options.accept_time_fudge to the
+ * boolean value of false in e2fsck.conf. We also support
+ * options.buggy_init_scripts for backwards compatibility.
*/
+ profile_get_boolean(ctx->profile, "options", "accept_time_fudge",
+ 0, 1, &accept_time_fudge);
profile_get_boolean(ctx->profile, "options", "buggy_init_scripts",
- 0, 0, &buggy_init_scripts);
- ctx->time_fudge = buggy_init_scripts ? 86400 : 0;
+ 0, accept_time_fudge, &accept_time_fudge);
+ ctx->time_fudge = accept_time_fudge ? 86400 : 0;
/*
* Check to see if the superblock last mount time or last
-- 1.6.5.104.g2567b.dirty

View File

@ -1,52 +0,0 @@
commit 06ef971be505678ee462ae1844204ed24f14aedc
Author: Theodore Ts'o <tytso@mit.edu>
Date: Thu Nov 12 17:54:45 2009 -0500
libss: initialize function pointer for readline_shutdown()
Clear the function pointer for readline_shutdown() so that if libss is
linking against a readline library which doesn't supply a
readline_shutdown() function, ss_delete_invocation() won't seg fault.
Thanks to Solar Designer <solar@openwall.com> for reporting this
problem to me.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
libss: add newer libreadline to dlopen path
Rawhide now has libreadline.so.6 ... add it to the ever-expanding
list of libs to look for.
Unfortunately without commit 06ef971be505678ee462ae1844204ed24f14aedc
this fails in a rather cryptic way.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
Index: e2fsprogs-1.41.9/lib/ss/invocation.c
===================================================================
--- e2fsprogs-1.41.9.orig/lib/ss/invocation.c
+++ e2fsprogs-1.41.9/lib/ss/invocation.c
@@ -71,6 +71,7 @@ int ss_create_invocation(subsystem_name,
*(new_table->rqt_tables+1) = (ss_request_table *) NULL;
new_table->readline_handle = 0;
+ new_table->readline_shutdown = 0;
new_table->readline = 0;
new_table->add_history = 0;
new_table->redisplay = 0;
Index: e2fsprogs-1.41.9/lib/ss/get_readline.c
===================================================================
--- e2fsprogs-1.41.9.orig/lib/ss/get_readline.c
+++ e2fsprogs-1.41.9/lib/ss/get_readline.c
@@ -36,7 +36,7 @@ static void ss_release_readline(ss_data
}
/* Libraries we will try to use for readline/editline functionality */
-#define DEFAULT_LIBPATH "libreadline.so.5:libreadline.so.4:libreadline.so:libedit.so.2:libedit.so:libeditline.so.0:libeditline.so"
+#define DEFAULT_LIBPATH "libreadline.so.6:libreadline.so.5:libreadline.so.4:libreadline.so:libedit.so.2:libedit.so:libeditline.so.0:libeditline.so"
void ss_get_readline(int sci_idx)
{

View File

@ -1,48 +0,0 @@
commit 40b09fbe01fac8722b699b29f796e18550d68c84
Author: Theodore Ts'o <tytso@mit.edu>
Date: Fri Feb 5 22:25:03 2010 -0500
resize2fs: Fix fix uninit group test accessing invalid memory
Commit 74128f8 added tests for uninit groups, but it could access past
the end of the group_desc[] array after processing the last group:
==19668== Invalid read of size 2
==19668== at 0x40518C: resize_fs (resize2fs.c:1824)
==19668== by 0x405A46: main (main.c:451)
==19668== Address 0x5a0d002 is not stack'd, malloc'd or (recently) free'd
==19668==
==19668== Invalid read of size 2
==19668== at 0x405391: resize_fs (resize2fs.c:1864)
==19668== by 0x405A46: main (main.c:451)
==19668== Address 0x5a0d002 is not stack'd, malloc'd or (recently) free'd
==19668==
It was found by Eric Sandeen running the regression suite through
valgrind.
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index 75c4721..346fd53 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -1819,6 +1819,8 @@ static errcode_t ext2fs_calculate_summary_stats(ext2_filsys fs)
group_free;
ext2fs_group_desc_csum_set(fs, group);
group++;
+ if (group >= fs->group_desc_count)
+ break;
count = 0;
group_free = 0;
uninit = (fs->group_desc[group].bg_flags &
@@ -1859,6 +1861,8 @@ static errcode_t ext2fs_calculate_summary_stats(ext2_filsys fs)
group_free;
ext2fs_group_desc_csum_set(fs, group);
group++;
+ if (group >= fs->group_desc_count)
+ break;
count = 0;
group_free = 0;
uninit = (fs->group_desc[group].bg_flags &

View File

@ -1,48 +0,0 @@
mkfsing a plain file would lead to a warning about being unable
to determine geometry; we should just skip the topology-getting
if we see that we have a regular file.
This was breaking "make check" but I had missed it since I
inadvertently stopped running the checks during the Fedora
RPM build.
Also, add a newline to the warning.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 94b4c81..81b34ab 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -47,6 +47,7 @@ extern int optind;
#endif
#include <sys/ioctl.h>
#include <sys/types.h>
+#include <sys/stat.h>
#include <libgen.h>
#include <limits.h>
#include <blkid/blkid.h>
@@ -1035,6 +1036,11 @@ static int ext2fs_get_device_geometry(const char *file,
blkid_topology tp;
unsigned long min_io;
unsigned long opt_io;
+ struct stat statbuf;
+
+ /* Nothing to do for a regular file */
+ if (!stat(file, &statbuf) && S_ISREG(statbuf.st_mode))
+ return 0;
pr = blkid_new_probe_from_filename(file);
if (!pr)
@@ -1630,7 +1636,7 @@ got_size:
retval = ext2fs_get_device_geometry(device_name, &fs_param);
if (retval < 0) {
fprintf(stderr,
- _("warning: Unable to get device geometry for %s"),
+ _("warning: Unable to get device geometry for %s\n"),
device_name);
} else if (retval) {
printf(_("%s alignment is offset by %lu bytes.\n"),

File diff suppressed because it is too large Load Diff

View File

@ -1,138 +0,0 @@
Try calling the BLKDISCARD ioctl at mkfs time to pre-discard all blocks
on an ssd, or a thinly-provisioned storage device.
No real error checking; if it fails, it fails, and that's ok - it's
just an optimization. Also, it cannot work in conjunction with
the undo io manager, for obvious reasons.
Optionally disabled with a "-K" (mnemonic: Keep) option.
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
Index: e2fsprogs-1.41.9/misc/mke2fs.8.in
===================================================================
--- e2fsprogs-1.41.9.orig/misc/mke2fs.8.in
+++ e2fsprogs-1.41.9/misc/mke2fs.8.in
@@ -45,6 +45,9 @@ mke2fs \- create an ext2/ext3/ext4 files
.I journal-options
]
[
+.B \-K
+]
+[
.B \-N
.I number-of-inodes
]
@@ -364,6 +367,10 @@ and may be no more than 102,400 filesyst
@JDEV@.BR size " or " device
@JDEV@options can be given for a filesystem.
.TP
+.BI \-K
+Keep, do not attempt to discard blocks at mkfs time (discarding blocks initially
+is useful on solid state devices and sparse / thin-provisioned storage).
+.TP
.BI \-l " filename"
Read the bad blocks list from
.IR filename .
Index: e2fsprogs-1.41.9/misc/mke2fs.c
===================================================================
--- e2fsprogs-1.41.9.orig/misc/mke2fs.c
+++ e2fsprogs-1.41.9/misc/mke2fs.c
@@ -79,6 +79,7 @@ int cflag;
int verbose;
int quiet;
int super_only;
+int discard = 1;
int force;
int noaction;
int journal_size;
@@ -111,7 +112,7 @@ static void usage(void)
"\t[-g blocks-per-group] [-L volume-label] "
"[-M last-mounted-directory]\n\t[-O feature[,...]] "
"[-r fs-revision] [-E extended-option[,...]]\n"
- "\t[-T fs-type] [-U UUID] [-jnqvFSV] device [blocks-count]\n"),
+ "\t[-T fs-type] [-U UUID] [-jnqvFKSV] device [blocks-count]\n"),
program_name);
exit(1);
}
@@ -1206,7 +1207,7 @@ static void PRS(int argc, char *argv[])
}
while ((c = getopt (argc, argv,
- "b:cf:g:G:i:jl:m:no:qr:s:t:vE:FI:J:L:M:N:O:R:ST:U:V")) != EOF) {
+ "b:cf:g:G:i:jl:m:no:qr:s:t:vE:FI:J:KL:M:N:O:R:ST:U:V")) != EOF) {
switch (c) {
case 'b':
blocksize = strtol(optarg, &tmp, 0);
@@ -1285,6 +1286,9 @@ static void PRS(int argc, char *argv[])
case 'J':
parse_journal_opts(optarg);
break;
+ case 'K':
+ discard = 0;
+ break;
case 'j':
if (!journal_size)
journal_size = -1;
@@ -1906,6 +1910,48 @@ static int mke2fs_setup_tdb(const char *
return retval;
}
+#ifdef __linux__
+
+#ifndef BLKDISCARD
+#define BLKDISCARD _IO(0x12,119)
+#endif
+
+static void mke2fs_discard_blocks(ext2_filsys fs)
+{
+ int fd;
+ int ret;
+ int blocksize;
+ __u64 blocks;
+ __uint64_t range[2];
+
+ blocks = fs->super->s_blocks_count;
+ blocksize = EXT2_BLOCK_SIZE(fs->super);
+ range[0] = 0;
+ range[1] = blocks * blocksize;
+
+ fd = open64(fs->device_name, O_RDONLY);
+
+ /*
+ * We don't care about whether the ioctl succeeds; it's only an
+ * optmization for SSDs or sparse storage.
+ */
+ if (fd > 0) {
+ ret = ioctl(fd, BLKDISCARD, &range);
+ if (verbose) {
+ printf(_("Calling BLKDISCARD from %llu to %llu "),
+ range[0], range[1]);
+ if (ret)
+ printf(_("failed.\n"));
+ else
+ printf(_("succeeded.\n"));
+ }
+ close(fd);
+ }
+}
+#else
+#define mke2fs_discard_blocks(fs)
+#endif
+
int main (int argc, char *argv[])
{
errcode_t retval = 0;
@@ -1949,6 +1995,11 @@ int main (int argc, char *argv[])
com_err(device_name, retval, _("while setting up superblock"));
exit(1);
}
+
+ /* Can't undo discard ... */
+ if (discard && (io_ptr != undo_io_manager))
+ mke2fs_discard_blocks(fs);
+
sprintf(tdb_string, "tdb_data_size=%d", fs->blocksize <= 4096 ?
32768 : fs->blocksize * 8);
io_channel_set_options(fs->io, tdb_string);

View File

@ -1,51 +0,0 @@
---
resize/resize2fs.c | 20 +++++++++++++++++---
1 files changed, 17 insertions(+), 3 deletions(-)
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index c0b00b6..648e1f9 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -1900,6 +1900,8 @@ blk_t calculate_minimum_resize_size(ext2_filsys fs)
blk_t inode_count, blks_needed, groups, data_blocks;
blk_t grp, data_needed, last_start;
int overhead = 0, num_of_superblocks = 0;
+ int extra_groups = 0;
+ int flexbg_size = 1 << fs->super->s_log_groups_per_flex;
/*
* first figure out how many group descriptors we need to
@@ -1934,11 +1936,9 @@ blk_t calculate_minimum_resize_size(ext2_filsys fs)
* of inode tables of slack space so the resize
* operation can be guaranteed to finish.
*/
- int flexbg_size = 1 << fs->super->s_log_groups_per_flex;
- int extra_groups;
-
extra_groups = flexbg_size - (groups & (flexbg_size - 1));
data_needed += META_OVERHEAD(fs) * extra_groups;
+ extra_groups = groups % flexbg_size;
}
/*
@@ -2002,6 +2002,20 @@ blk_t calculate_minimum_resize_size(ext2_filsys fs)
}
groups += extra_grps;
+ extra_groups += extra_grps;
+ if (fs->super->s_feature_incompat
+ & EXT4_FEATURE_INCOMPAT_FLEX_BG
+ && extra_groups > flexbg_size) {
+ /*
+ * For ext4 we need to allow for up to a flex_bg worth
+ * of inode tables of slack space so the resize
+ * operation can be guaranteed to finish.
+ */
+ extra_groups = flexbg_size -
+ (groups & (flexbg_size - 1));
+ data_needed += META_OVERHEAD(fs) * extra_groups;
+ extra_groups = groups % flexbg_size;
+ }
}
/* now for the fun voodoo */

View File

@ -3,8 +3,8 @@
Summary: Utilities for managing ext2, ext3, and ext4 filesystems
Name: e2fsprogs
Version: 1.41.9
Release: 10%{?dist}
Version: 1.41.10
Release: 1%{?dist}
# License tags based on COPYING file distinctions for various components
License: GPLv2
@ -13,14 +13,6 @@ Source0: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
Source1: ext2_types-wrapper.h
Patch2: e2fsprogs-1.40.4-sb_feature_check_ignore.patch
Patch4: e2fsprogs-resize-minimum-fix.patch
Patch5: e2fsprogs-1.41.9-24hr-fsck-grace.patch
Patch6: e2fsprogs-1.41.9-topology.patch
Patch7: e2fsprogs-1.41.9-trim.patch
Patch8: e4fsprogs-1.41.9-s_jnl_blocks-swap.patch
Patch9: e2fsprogs-1.41.9-topology-quiet.patch
Patch10: e2fsprogs-1.41.9-resize-array.patch
Patch11: e2fsprogs-1.41.9-dlopen-fix.patch
Url: http://e2fsprogs.sourceforge.net/
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
@ -146,14 +138,6 @@ It was originally inspired by the Multics SubSystem library.
# mildly unsafe but 'til I get something better, avoid full fsck
# after an selinux install...
%patch2 -p1 -b .featurecheck
%patch4 -p1 -b .resize
%patch5 -p1 -b .24h
%patch6 -p1 -b .topo
%patch7 -p1 -b .trim
%patch8 -p1 -b .journalblocks
%patch9 -p1 -b .topo2
%patch10 -p1 -b .resize2
%patch11 -p1 -b .dlopen
%build
%configure --enable-elf-shlibs --enable-nls --disable-uuidd --disable-fsck \
@ -317,6 +301,9 @@ exit 0
%{_libdir}/pkgconfig/ss.pc
%changelog
* Wed Feb 10 2010 Eric Sandeen <sandeen@redhat.com> 1.41.10-1
- New upstream version
* Sun Feb 07 2010 Eric Sandeen <sandeen@redhat.com> 1.41.9-10
- Upstream version of resize2fs array fix, original was wrong

View File

@ -1,48 +0,0 @@
libext2fs: don't swap extent-based journal backup on read
The f_illitable_flexbg test was failing on ppc, because
e2fsck_move_ext3_journal is doing a direct memcmp of i_block with
s_jnl_blocks, and failing.
This is because we don't swap extent data on read from disk; rather
we do it when we access the extents. However, ext2fs_swap_super
was swapping s_jnl_blocks unconditionally, so these didn't match.
Looks like we need to treat s_jnl_blocks the same as i_block, and
swap it on access, not on read. Except for the last i_size bit...
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
---
diff --git a/lib/ext2fs/swapfs.c b/lib/ext2fs/swapfs.c
index 42bc01e..38f5f9b 100644
--- a/lib/ext2fs/swapfs.c
+++ b/lib/ext2fs/swapfs.c
@@ -73,9 +73,19 @@ void ext2fs_swap_super(struct ext2_super_block * sb)
sb->s_kbytes_written = ext2fs_swab64(sb->s_kbytes_written);
for (i=0; i < 4; i++)
sb->s_hash_seed[i] = ext2fs_swab32(sb->s_hash_seed[i]);
+
+ /* if journal backup is for a valid extent-based journal... */
+ if (!ext2fs_extent_header_verify(sb->s_jnl_blocks,
+ sizeof(sb->s_jnl_blocks))) {
+ /* ... swap only the journal i_size */
+ sb->s_jnl_blocks[16] = ext2fs_swab32(sb->s_jnl_blocks[16]);
+ /* and the extent data is not swapped on read */
+ return;
+ }
+
+ /* direct/indirect journal: swap it all */
for (i=0; i < 17; i++)
sb->s_jnl_blocks[i] = ext2fs_swab32(sb->s_jnl_blocks[i]);
-
}
void ext2fs_swap_group_desc(struct ext2_group_desc *gdp)
--
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

View File

@ -1 +1 @@
52f60a9e19a02f142f5546f1b5681927 e2fsprogs-1.41.9.tar.gz
f9c7bb5c036a119453ce02fa871038da e2fsprogs-1.41.10.tar.gz