From 10fc3a63d9b7efb14e810ee94ad1d2f254d44eae Mon Sep 17 00:00:00 2001 From: Eric Sandeen Date: Thu, 25 Apr 2013 00:14:33 -0400 Subject: [PATCH 1/5] e2fsprogs: allow 0-length xattr values in e2fsck e2fsck thinks that this: # touch mnt/testfile1 # setfattr -n "user.test" mnt/testfile1 results in a filesystem with corruption: Pass 1: Checking inodes, blocks, and sizes Extended attribute in inode 12 has a value size (0) which is invalid Clear? yes but as far as I can tell, there is absolutely nothing wrong with a 0-length value on an extended attribute. Just remove the check. Reported-by: David Shaw Reported-by: Harald Reindl Addresses-Red-Hat-Bugzilla: #557959 Signed-off-by: Eric Sandeen Signed-off-by: Theodore Ts'o --- e2fsck/pass1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/e2fsck/pass1.c b/e2fsck/pass1.c index 9c375154..40957030 100644 --- a/e2fsck/pass1.c +++ b/e2fsck/pass1.c @@ -307,7 +307,7 @@ static void check_ea_in_inode(e2fsck_t ctx, struct problem_context *pctx) remain -= EXT2_EXT_ATTR_SIZE(entry->e_name_len); /* check value size */ - if (entry->e_value_size == 0 || entry->e_value_size > remain) { + if (entry->e_value_size > remain) { pctx->num = entry->e_value_size; problem = PR_1_ATTR_VALUE_SIZE; goto fix; From 5dfd5ef88d2c285050b7f120818e51045cfe845e Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Thu, 25 Apr 2013 00:28:05 -0400 Subject: [PATCH 2/5] tests: add new test f_zero_xattr E2fsck previously was complaining with zero-length extended attributes if they appeared in the in-inode xattr space. Test to make sure e2fsck is now happy with such xattrs. Signed-off-by: "Theodore Ts'o" --- tests/f_zero_xattr/expect.1 | 7 +++++++ tests/f_zero_xattr/image.gz | Bin 0 -> 707 bytes tests/f_zero_xattr/name | 1 + tests/f_zero_xattr/script | 2 ++ 4 files changed, 10 insertions(+) create mode 100644 tests/f_zero_xattr/expect.1 create mode 100644 tests/f_zero_xattr/image.gz create mode 100644 tests/f_zero_xattr/name create mode 100644 tests/f_zero_xattr/script diff --git a/tests/f_zero_xattr/expect.1 b/tests/f_zero_xattr/expect.1 new file mode 100644 index 00000000..0733af6e --- /dev/null +++ b/tests/f_zero_xattr/expect.1 @@ -0,0 +1,7 @@ +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 +test_filesys: 12/24 files (0.0% non-contiguous), 25/200 blocks +Exit status is 0 diff --git a/tests/f_zero_xattr/image.gz b/tests/f_zero_xattr/image.gz new file mode 100644 index 0000000000000000000000000000000000000000..40055520207601ed0dbd5f8f9a7cacad3004d831 GIT binary patch literal 707 zcmb2|=HQT7TM@{_oSB=Lp33m{u3?67pajE%?|PaZ(km8uwDWb%c8U@&+A2sTQ_L)4x6y3HGz)YY6Ikta)zBr~N{kuHBrux`lnFElYd& z;)~*SWs&=@F!1eOQ#!Xl(sb+3&pNBaK1=;`d2v4PO5WM|vsd1ow|n08Q}4Z(S_H42 zY4K1%;>C&o@0Z&AZXZ*>3q8=>7z+llK)qJpj!9w?$ zjEoG(;K75H*TvOtUG#o@Zx%tUk=p8z|8LU&t=D;;yZN2ixaelUwb3|Nrdn z-CD+bphp{k)1vW*$r~vxr14aA{Z2y F8335M83O Date: Sat, 4 May 2013 19:01:09 -0400 Subject: [PATCH 3/5] configure: update configure script to be in sync with the configure.in file Signed-off-by: "Theodore Ts'o" --- configure | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/configure b/configure index da1bcb6c..c91e6059 100755 --- a/configure +++ b/configure @@ -640,6 +640,7 @@ LINUX_CMT UNI_DIFF_OPTS SEM_INIT_LIB SOCKET_LIB +SIZEOF_OFF_T SIZEOF_LONG_LONG SIZEOF_LONG SIZEOF_INT @@ -10574,10 +10575,45 @@ cat >>confdefs.h <<_ACEOF _ACEOF +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of off_t" >&5 +$as_echo_n "checking size of off_t... " >&6; } +if ${ac_cv_sizeof_off_t+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (off_t))" "ac_cv_sizeof_off_t" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_off_t" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (off_t) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_off_t=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_off_t" >&5 +$as_echo "$ac_cv_sizeof_off_t" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_OFF_T $ac_cv_sizeof_off_t +_ACEOF + + SIZEOF_SHORT=$ac_cv_sizeof_short SIZEOF_INT=$ac_cv_sizeof_int SIZEOF_LONG=$ac_cv_sizeof_long SIZEOF_LONG_LONG=$ac_cv_sizeof_long_long +SIZEOF_OFF_T=$ac_cv_sizeof_off_t + From 26991d026e4b555229a4466ae4d003420321bbd2 Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Sat, 4 May 2013 19:07:18 -0400 Subject: [PATCH 4/5] e2fsck: don't use IO_FLAG_EXCLUSIVE for read-only root file systems When opening the external journal, use the same logic to decide whether or not to open the file system with EXT2_FLAG_EXCLUSIVE found in main(). Otherwise, it's not posible to use e2fsck when the root file system is using an external journal. Reported-by: Calvin Owens Signed-off-by: "Theodore Ts'o" --- e2fsck/journal.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/e2fsck/journal.c b/e2fsck/journal.c index 767ea105..69771da6 100644 --- a/e2fsck/journal.c +++ b/e2fsck/journal.c @@ -372,9 +372,19 @@ static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal) #ifndef USE_INODE_IO if (ext_journal) #endif - retval = io_ptr->open(journal_name, - IO_FLAG_RW | IO_FLAG_EXCLUSIVE, + { + int flags = IO_FLAG_RW; + if (!(ctx->mount_flags & EXT2_MF_ISROOT && + ctx->mount_flags & EXT2_MF_READONLY)) + flags |= IO_FLAG_EXCLUSIVE; + if ((ctx->mount_flags & EXT2_MF_READONLY) && + (ctx->options & E2F_OPT_FORCE)) + flags &= ~IO_FLAG_EXCLUSIVE; + + + retval = io_ptr->open(journal_name, flags, &ctx->journal_io); + } if (retval) goto errout; From 25399080c5b100fe7499334c30184592d68bc99d Mon Sep 17 00:00:00 2001 From: Theodore Ts'o Date: Mon, 13 May 2013 09:10:16 -0400 Subject: [PATCH 5/5] chattr: clarify that the compression flags are not supported by ext4 ... or indeed by any mainline kernel, since the compression patches were never stablized. Addresses-Debian-Bug: #707609 Signed-off-by: "Theodore Ts'o" Reported-by: "Creidieki M. Crouch" --- misc/chattr.1.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/misc/chattr.1.in b/misc/chattr.1.in index 64aab7ba..932ef4bc 100644 --- a/misc/chattr.1.in +++ b/misc/chattr.1.in @@ -168,8 +168,8 @@ was written by Remy Card . It is currently being maintained by Theodore Ts'o . .SH BUGS AND LIMITATIONS The `c', 's', and `u' attributes are not honored -by the ext2 and ext3 filesystems as implemented in the current mainline -Linux kernels. +by the ext2, ext3, and ext4 filesystems as implemented in the current +mainline Linux kernels. .PP The `j' option is only useful if the filesystem is mounted as ext3. .PP