From nobody@FreeBSD.org  Sat Oct  7 20:00:55 2006
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 519DE16A5DC
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  7 Oct 2006 20:00:55 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [216.136.204.117])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 493E743D6D
	for <freebsd-gnats-submit@FreeBSD.org>; Sat,  7 Oct 2006 20:00:50 +0000 (GMT)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.13.1/8.13.1) with ESMTP id k97K0o9A051793
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 7 Oct 2006 20:00:50 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.13.1/8.13.1/Submit) id k97K0ojR051792;
	Sat, 7 Oct 2006 20:00:50 GMT
	(envelope-from nobody)
Message-Id: <200610072000.k97K0ojR051792@www.freebsd.org>
Date: Sat, 7 Oct 2006 20:00:50 GMT
From: Bjoern Voigt<bjoern@cs.tu-berlin.de>
To: freebsd-gnats-submit@FreeBSD.org
Subject: EXT2FS module corrupts EXT2/3 filesystems
X-Send-Pr-Version: www-2.3

>Number:         104133
>Category:       kern
>Synopsis:       [ext2fs] EXT2FS module corrupts EXT2/3 filesystems
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-fs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 07 20:10:19 GMT 2006
>Closed-Date:    Sat Jan 11 01:09:26 UTC 2014
>Last-Modified:  Sat Jan 11 01:09:26 UTC 2014
>Originator:     Bjoern Voigt
>Release:        6.2-PRERELEASE
>Organization:
>Environment:
FreeBSD mybox 6.2-PRERELEASE FreeBSD 6.2-PRERELEASE #0: Tue Sep 12 18:28:25 CEST 2006
>Description:
FreeBSDs EXT2FS module seems to corrupt EXT2 and EXT3 filesystems in R/W
mount mode. 

The tested filesystem is configured as an EXT3 filesystem (EXT2 + journal).
Normally EXT3 filesystems can be used as EXT2 filesystems without problems.

After unmounting the filesystem e2fsck says that the filesystem is "clean".
But Linux find's filesystem errors in such filesystems. Also e2fsck under
Linux and FreeBSD finds errors in a forced check.

# umount -a -text2fs
# fsck -p -f -t ext2fs /dev/ad1s7
/dev/ad1s7: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
        (i.e., without -a or -p options)
# fsck -f -t ext2fs /dev/ad1s7
e2fsck 1.39 (29-May-2006)
Pass 1: Checking inodes, blocks, and sizes
Inode 2025329 has a bad extended attribute block 4129938.  Clear<y>? yes
Inode 2025322 has a bad extended attribute block 4132380.  Clear<y>? yes
Inode 2025338 has a bad extended attribute block 4132399.  Clear<y>? yes
Inode 2025327 has a bad extended attribute block 4172620.  Clear<y>? yes
Inode 2025348, i_blocks is 0, should be 8.  Fix<y>? yes
[...]
>How-To-Repeat:
1. Mount an EXT2/3 filesystem under FreeBSD in R/W mode
   e.g. mount -a -t ext2fs
2. Use it (heavy usage like compiling a source code increases the amount of
   filesystem errors)
3. Unmount the EXT2/3 filesystem under FreeBSD
   e.g. umount -a -t ext2fs
4. Force an fsck check
   e.g. fsck -f -t ext2fs /dev/XXX
>Fix:

>Release-Note:
>Audit-Trail:

From: Bjoern Voigt <bjoern@cs.tu-berlin.de>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/104133: [ext2fs] EXT2FS module corrupts EXT2/3 filesystems
Date: Sun, 22 Oct 2006 18:13:16 +0200

 The problem is probably unrelated to EXT3's journal. The ext2fs module 
 could simply ignore the journal like Linux's ext2 module.
 
 In the attached journal there are many errors like this: "Inode 2026233 
 has a bad extended attribute block 4130036.  Clear<y>"
 
 I mounted the file system with these options in Linux:
 
 /dev/hdb6            /                    ext3       
 defaults,user_xattr   1 1
 
 May be FreeBSDs ext2fs module does not handle extended attributes right?
 
 
 
 
 
 mybox# e2fsck /dev/ad1s6
 /dev/ad1s6: 29865/128520 files (4.0% non-contiguous), 346697/514048 blocks
 /dev/ad1s7: Inode 376345, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s7: Inode 376338, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 376342, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 376323, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 376337, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 376339, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 376341, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 376343, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 376340, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 376336, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 2004133, i_blocks is 48, should be 56.  FIXED.
 /dev/ad1s7: Inode 2004142, i_blocks is 80, should be 88.  FIXED.
 /dev/ad1s7: Inode 2004159, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 2004164, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 2004230, i_blocks is 24, should be 32.  FIXED.
 /dev/ad1s7: Inode 2004149, i_blocks is 56, should be 64.  FIXED.
 /dev/ad1s7: Inode 2004184, i_blocks is 40, should be 48.  FIXED.
 /dev/ad1s7: Inode 2004231, i_blocks is 24, should be 32.  FIXED.
 /dev/ad1s7: Inode 2004156, i_blocks is 24, should be 32.  FIXED.
 /dev/ad1s7: Inode 2004212, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 2004228, i_blocks is 24, should be 32.  FIXED.
 /dev/ad1s7: Inode 2004527, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 2004129, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 2004141, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s7: Inode 2004192, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 2004226, i_blocks is 56, should be 64.  FIXED.
 /dev/ad1s7: Inode 2004195, i_blocks is 16, should be 24.  FIXED.
 /dev/ad1s7: Inode 2004239, i_blocks is 48, should be 56.  FIXED.
 /dev/ad1s7: Inode 2004217, i_blocks is 32, should be 40.  FIXED.
 /dev/ad1s7: Inode 2007616, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s7: Inode 2023789, i_blocks is 88, should be 96.  FIXED.
 /dev/ad1s7: Inode 2026233 has a bad extended attribute block 4130036.  
 
 /dev/ad1s7: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
     (i.e., without -a or -p options)
 
 /dev/ad1s9: 1031163/3276800 files (10.9% non-contiguous), 
 5273863/6552504 blocks
 /dev/ad1s8: Inode 657, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 663, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 708, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 739, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 678, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 810, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 705, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 689, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 822, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 827, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 905, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 835, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 849, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 637, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 636, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 650, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 646, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 647, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 652, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 834, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 906, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 638, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 641, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 645, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 658, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 824, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 656, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 653, i_blocks is 8, should be 16.  FIXED.
 /dev/ad1s8: Inode 142375, i_blocks is 80, should be 88.  FIXED.
 /dev/ad1s8: Extended attribute block 24210 has reference count 1, should 
 be 2.  
 
 /dev/ad1s8: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
     (i.e., without -a or -p options)
 mybox#
 mybox# e2fsck /dev/ad1s7
 e2fsck 1.39 (29-May-2006)
 /dev/ad1s7 contains a file system with errors, check forced.
 Pass 1: Checking inodes, blocks, and sizes
 Inode 2026233 has a bad extended attribute block 4130036.  Clear<y>? yes
 
 Inode 2026236 has a bad extended attribute block 4132383.  Clear<y>? yes
 
 Inode 2026229 has a bad extended attribute block 4182190.  Clear<y>? yes
 
 Inode 2026231 has a bad extended attribute block 4182196.  Clear<y>? yes
 
 Inode 2026238 has a bad extended attribute block 4185475.  Clear<y>? yes
 
 Inode 2026243 has a bad extended attribute block 4188981.  Clear<y>? yes
 
 Inode 2026241 has a bad extended attribute block 4189402.  Clear<y>? yes
 
 Inode 2037265 has a bad extended attribute block 4306813.  Clear<y>? yes
 
 Inode 2037266 has a bad extended attribute block 4306842.  Clear<y>? yes
 
 Inode 2037232 has a bad extended attribute block 4312180.  Clear<y>? yes
 
 Inode 2037262 has a bad extended attribute block 4312808.  Clear<y>? yes
 
 Pass 2: Checking directory structure
 Pass 3: Checking directory connectivity
 Pass 3A: Optimizing directories
 Pass 4: Checking reference counts
 Pass 5: Checking group summary information
 Block bitmap differences:  +754512 +754954 +(755140--755141) +755279 
 +755360 +(755421--755422) +755461 +755494 +4035038 +4035043 +4035059 
 +(4035223--4035224) +4035600 +(4035602--4035603) +(4035626--4035628) 
 +4042808 +(4048376--4048378) +4051224 +4057224 -4116921
 Fix<y>? yes
 
 Free blocks count wrong for group #23 (25295, counted=25285).
 Fix<y>? yes
 
 Free blocks count wrong for group #123 (244, counted=227).
 Fix<y>? yes
 
 Free blocks count wrong for group #125 (3, counted=4).
 Fix<y>? yes
 
 Free blocks count wrong (430390, counted=430364).
 Fix<y>? yes
 
 
 /dev/ad1s7: ***** FILE SYSTEM WAS MODIFIED *****
 /dev/ad1s7: 485123/2231456 files (8.0% non-contiguous), 4027665/4458029 
 blocks
 mybox# e2fsck /dev/ad1s7
 
 e2fsck 1.39 (29-May-2006)
 /dev/ad1s8 contains a file system with errors, check forced.
 Pass 1: Checking inodes, blocks, and sizes
 Extended attribute block 24210 has reference count 1, should be 2.  
 Fix<y>? yes
 
 Extended attribute block 24211 has reference count 1, should be 2.  
 Fix<y>? yes
 
 Extended attribute block 24259 has reference count 1, should be 2.  
 Fix<y>? yes
 
 Extended attribute block 24260 has reference count 1, should be 2.  
 Fix<y>? yes
 
 Extended attribute block 24261 has reference count 1, should be 2.  
 Fix<y>? yes
 
 Extended attribute block 24262 has reference count 1, should be 2.  
 Fix<y>? yes
 
 Extended attribute block 24263 has reference count 1, should be 2.  
 Fix<y>? yes
 
 Extended attribute block 24264 has reference count 1, should be 2.  
 Fix<y>? yes
 
 Pass 2: Checking directory structure
 yyPass 3: Checking directory connectivity
 Pass 3A: Optimizing directories
 Pass 4: Checking reference counts
 Pass 5: Checking group summary information
 Block bitmap differences:  +45033 +(45035--45038) +45240 +45272 
 +(45420--45422) +46135 +(46143--46144) +46189 +(46191--46193) +46203 
 +(46214--46215)
 Fix<y>? yes
 
 Free blocks count wrong for group #1 (13041, counted=13021).
 Fix<y>? yes
 
 Free blocks count wrong (30737, counted=30717).
 Fix<y>? yes
 
 
 /dev/ad1s8: ***** FILE SYSTEM WAS MODIFIED *****
 /dev/ad1s8: 49482/157760 files (8.1% non-contiguous), 284550/315267 blocks
 

From: Bruce Evans <bde@zeta.org.au>
To: Bjoern Voigt <bjoern@cs.tu-berlin.de>
Cc: freebsd-gnats-submit@freebsd.org
Subject: Re: kern/104133: [ext2fs] EXT2FS module corrupts EXT2/3 filesystems
Date: Mon, 23 Oct 2006 14:49:49 +1000 (EST)

 On Sun, 22 Oct 2006, Bjoern Voigt wrote:
 
 > ...
 > May be FreeBSDs ext2fs module does not handle extended attributes right?
 
 FreeBSD's ext2fs doesn't handle extended attributes at all, except it is
 supposed to disallow mounting of file systems that use them (even for
 read-only mounts).
 
 The set of features known to FreeBSD's ext2fs is smaller than the set known
 Linux's ext2fs and is much smaller than the set of features supported.  The
 former was last up to date 6-7 years ago.  All features newer than this are
 supposed to prevent mounting.  ext2fs in Linux also does a better job of
 downgrading attributes so that mounting is possible.
 
 Bruce

From: Bjoern Voigt <bjoern@cs.tu-berlin.de>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/104133: [ext2fs] EXT2FS module corrupts EXT2/3 filesystems
Date: Mon, 23 Oct 2006 21:33:56 +0200

 But FreeBSD's ext2fs does not refuse to mount ext2 or ext3 file systems 
 with extended attributes (user_xattr). Mount does not show any errors or 
 warnings.
 
 The information weather or not an ext2/3 file system contains extended 
 attributes or not can not be found in the output of dumpe2fs:
 
     # dumpe2fs /dev/hda6
     dumpe2fs 1.38 (30-Jun-2005)
     Filesystem volume name:   rootvol
     Last mounted on:          <not available>
     Filesystem UUID:          15b97410-f7a5-4494-b34d-3eafdc142665
     Filesystem magic number:  0xEF53
     Filesystem revision #:    1 (dynamic)
     Filesystem features:      has_journal filetype sparse_super
     Default mount options:    (none)
     Filesystem state:         clean
     Errors behavior:          Continue
     Filesystem OS type:       Linux
     Inode count:              66264
     Block count:              265041
     Reserved block count:     13252
     Free blocks:              63641
     Free inodes:              43603
     First block:              1
     Block size:               1024
     Fragment size:            1024
     Blocks per group:         8192
     Fragments per group:      8192
     Inodes per group:         2008
     Inode blocks per group:   251
     Last mount time:          Sun Aug  6 17:43:47 2006
     Last write time:          Sun Aug  6 17:52:15 2006
     Mount count:              1
     Maximum mount count:      38
     Last checked:             Sun Aug  6 17:43:35 2006
     Check interval:           15552000 (6 months)
     Next check after:         Fri Feb  2 16:43:35 2007
     Reserved blocks uid:      0 (user root)
     Reserved blocks gid:      0 (group root)
     First inode:              11
     Inode size:               128
     Journal inode:            8
     Journal backup:           inode blocks
 
 
     Group 0: (Blocks 1-8192)
       Primary superblock at 1, Group descriptors at 2-3
       Block bitmap at 4 (+3), Inode bitmap at 5 (+4)
       Inode table at 6-256 (+5)
       3473 free blocks, 0 free inodes, 6 directories
       Free blocks: 731-743, [...]
 
 

From: Bruce Evans <bde@zeta.org.au>
To: Bjoern Voigt <bjoern@cs.tu-berlin.de>
Cc: freebsd-gnats-submit@FreeBSD.org
Subject: Re: kern/104133: [ext2fs] EXT2FS module corrupts EXT2/3 filesystems
Date: Tue, 24 Oct 2006 12:06:06 +1000 (EST)

 On Mon, 23 Oct 2006, Bjoern Voigt wrote:
 
 > But FreeBSD's ext2fs does not refuse to mount ext2 or ext3 file systems
 > with extended attributes (user_xattr). Mount does not show any errors or
 > warnings.
 
 Right, it was your task to find why it doesn't :-), but I think I figured
 that out: out
 
 > The information weather or not an ext2/3 file system contains extended
 > attributes or not can not be found in the output of dumpe2fs:
 >
 >     # dumpe2fs /dev/hda6
 >     dumpe2fs 1.38 (30-Jun-2005)
 > ...
 >     Filesystem features:      has_journal filetype sparse_super
 
 This doesn't mention extended attributes.  This seems to be a bug in
 dumpe2fs.
 
 The problem wth not disallowing mounts with extended attributes seems
 to be that extended attributes are supposed to be (always) backwards
 compatible (except to ext2fs version 0, which doesn't even have the
 features bitmaps) -- they are in the features bitmap for compatible
 attributes.  FreeBSD's ext2fs only checks the features bitmaps for
 incompatible and read-only-compatible attributes.  In the above,
 has_journal is supposed to be compatible, filetype is incompatible but
 supported by FreeBSD (i.e., it is incompatible with some implementations
 but not with FreeBSD's), and sparse_super is read-only compatible but
 supported by FreeBSD (i.e., it is always compatible for read-only
 mounts, and for read-write mounts it is incompatible with some
 implementations but not with FreeBSD's).
 
 Now your task is to figure out why has_journal and/or extended attributes
 are supposed to be compatible but aren't :-).  I don't see how they
 can be read-write compatible.  Linux-2.6.10's handling of the feature
 flags for them is simple:
 - journal: ext2fs just prints a warning if the journal feature bit is set.
    There is also an incompat journal feature.  These are the only ext3
    features known to ext2fs.
 - extended attributes: ext2fs's only handling of the feature bit for this
    is to force it to be set.  Otherwise, it seems to just support extended
    attributes.
 
 Try using an ext3 file system that doesn't use extended attributes in
 any way, to see if FreeBSD's ext2fs creates bad extended attributes
 starting from non.  e2fsck and/or tune2fs might be able to remove any
 existing extended attributes.
 
 Bruce

From: Bjoern Voigt <bjoern@cs.tu-berlin.de>
To: freebsd-gnats-submit@FreeBSD.org
Cc: Bruce Evans <bde@zeta.org.au>
Subject: Re: kern/104133: [ext2fs] EXT2FS module corrupts EXT2/3 filesystems
Date: Tue, 24 Oct 2006 17:15:21 +0200

 Thank you for the good explanation.
 
 Bruce Evans wrote:
 > Right, it was your task to find why it doesn't :-), but I think I figured
 > that out: out
 I'm not an file system expert. But I like to help to find out the reason 
 for the problem.
 
 >> attributes or not can not be found in the output of dumpe2fs:
 >>
 >>     # dumpe2fs /dev/hda6
 >>     dumpe2fs 1.38 (30-Jun-2005)
 >> ...
 >>     Filesystem features:      has_journal filetype sparse_super
 > The information weather or not an ext2/3 file system contains extended
 >
 > This doesn't mention extended attributes.  This seems to be a bug in
 > dumpe2fs.
 Sorry, /dev/hda6 was not the right device. The right is /dev/hdb6 
 (=/dev/ad1s6 in my FreeBSD installation). Here is the dump for /dev/hdb6:
 
     Filesystem volume name:   <none>
     Last mounted on:          <not available>
     Filesystem UUID:          d7e5aa99-4705-4294-9a88-800c15732c39
     Filesystem magic number:  0xEF53
     Filesystem revision #:    1 (dynamic)
     Filesystem features:      has_journal ext_attr dir_index filetype
     needs_recovery sparse_super
     Default mount options:    (none)
     Filesystem state:         clean
     Errors behavior:          Continue
     Filesystem OS type:       Linux
     Inode count:              128520
     Block count:              514048
     Reserved block count:     25702
     Free blocks:              167317
     Free inodes:              98653
     First block:              1
     Block size:               1024
     Fragment size:            1024
     Blocks per group:         8192
     Fragments per group:      8192
     Inodes per group:         2040
     Inode blocks per group:   255
     Filesystem created:       Sat Apr 17 17:20:47 2004
     Last mount time:          Tue Oct 24 15:25:58 2006
     Last write time:          Tue Oct 24 15:25:58 2006
     Mount count:              1
     Maximum mount count:      500
     Last checked:             Tue Oct 24 15:25:39 2006
     Check interval:           5184000 (2 months)
     Next check after:         Sat Dec 23 14:25:39 2006
     Reserved blocks uid:      0 (user root)
     Reserved blocks gid:      0 (group root)
     First inode:              11
     Inode size:               128
     Journal inode:            8
     Default directory hash:   tea
     Directory Hash Seed:      f4de9257-4024-4732-9733-112fc61399aa
     Journal backup:           inode blocks
 
 All of the set features (has_journal, ext_attr, dir_index, filetype, 
 needs_recovery, sparse_super) are now candidates for the problem in the 
 ext2fs module.
 
 > The problem wth not disallowing mounts with extended attributes seems
 > to be that extended attributes are supposed to be (always) backwards
 > compatible (except to ext2fs version 0, which doesn't even have the
 > features bitmaps) -- they are in the features bitmap for compatible
 > attributes.  FreeBSD's ext2fs only checks the features bitmaps for
 > incompatible and read-only-compatible attributes.  In the above,
 > has_journal is supposed to be compatible, filetype is incompatible but
 > supported by FreeBSD (i.e., it is incompatible with some implementations
 > but not with FreeBSD's), and sparse_super is read-only compatible but
 > supported by FreeBSD (i.e., it is always compatible for read-only
 > mounts, and for read-write mounts it is incompatible with some
 > implementations but not with FreeBSD's).
 So, "has_journal", "spare_super" and "filetype" are ok. The remaining 
 candidates are now "ext_attr" and "dir_index". "needs_recovery" is 
 caused by the fact that I queried a mounted file system.
 
 > Try using an ext3 file system that doesn't use extended attributes in
 > any way, to see if FreeBSD's ext2fs creates bad extended attributes
 > starting from non.  e2fsck and/or tune2fs might be able to remove any
 > existing extended attributes.
 The problem is, that I did not found a way to remove the extended 
 attributes feature. I figured out the following:
 
     * a single file attribute can be cleared with setfattr.
     * user_xattr is a mount option. tune2fs can turn on the mount option
       per default for a file system. Turning off the mount option does
       not clear the "ext_attr" feature. From "man tune2fs":
 
              -o [^]mount-option[,...]
                     Set or clear the indicated default mount options in
       the filesystem.  Default  mount
                     options  can be overridden by mount options
       specified either in /etc/fstab(5) or on
                     the command line arguments to mount(8).  Older
       kernels may not  support  this  fea-
                     ture;  in particular, kernels which predate 2.4.20
       will almost certainly ignore the
                     default mount options field in the superblock.
 
                     More than one mount option can be cleared or set by
       separating features  with  com-
                     mas.   Mount  options  prefixed with a caret
       character ('^') will be cleared in the
                     filesystem's superblock; mount options without a
       prefix character or prefixed  with
                     a plus character ('+') will be added to the filesystem.
 
                     The following mount options can be set or cleared
       using tune2fs:
                     [...]
 
                          user_xattr
                                 Enable user-specified extended attributes.
 
     * tune2fs can set und clear some file system features. In "man
       tune2fs" the features "dir_index", "filetype", "has_journal" and
       "sparse_super" are mentioned. But "ext_attr" is not mentioned and
       is not recognized.
     * e2fsck has no option for turning off extended attributes. The is
       only a option to switch the extended attribute format. From "man
       e2fsck":
 
       -E extended_options
                     Set e2fsck extended options.  Extended options are
       comma separated, and may take an
                     argument using the equals ('=') sign.  The following
       options are supported:
 
                          ea_ver=extended_attribute_version
                                 Assume the format of the extended
       attribute blocks in the filesystem is
                                 the  specified  version number.  The
       version number may be 1 or 2.  The
                                 default extended attribute version
       format is 2.
     * mke2fs has no option to set the extended attributes feature. Since
       also tune2fs doesn't has such an option, it's likely that the
       feature will be set automatically after first mount with option
       "user_xattr" and after the first attribute is set for a file in
       this file system. A short test approved this.
 
 I have not figured out, how to clean a file system from extended 
 attributes.
 
 So probably I have to create a new file system without extended 
 attributes for testing the ext2fs module.
 
 Any ideas?
 
 Bj?rn
 

From: Jaakko Heinonen <jh@saunalahti.fi>
To: bjoern@cs.tu-berlin.de
Cc: bug-followup@FreeBSD.org
Subject: Re: kern/104133: [ext2fs] EXT2FS module corrupts EXT2/3 filesystems
Date: Sun, 4 Jan 2009 13:04:15 +0200

 Hi,
 
 Is this happening on amd64? Could you try if the patch in the following
 message fixes the problem?
 
 http://lists.freebsd.org/pipermail/freebsd-fs/2009-January/005546.html
 
 -- 
 Jaakko
State-Changed-From-To: open->feedback 
State-Changed-By: vwe 
State-Changed-When: Sun Jan 18 22:55:41 UTC 2009 
State-Changed-Why:  

Note that submitter has been asked for feedback. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=104133 

From: Bjoern Voigt <bjoern@cs.tu-berlin.de>
To: vwe@FreeBSD.org
Cc:  
Subject: Re: kern/104133: [ext2fs] EXT2FS module corrupts EXT2/3 filesystems
Date: Tue, 20 Jan 2009 18:35:45 +0100

 No, my system is a i386 system (AMD Athlon(tm) XP 1900+). I tried the 
 suggested patch
 
 http://lists.freebsd.org/pipermail/freebsd-fs/2009-January/005546.html
 
 together with FreeBSD 7.1. Unfortunately I also had to apply the patch
 
 http://www.freebsd.org/cgi/query-pr.cgi?pr=124621
 
 because I recently formatted my ext3 partitions with a nonstandard inode 
 size (128 Byte) and mounting in FreeBSD is also possible with this 
 patch. I worked some hours with the patched FreeBSD 7.1 system.
 
 Unfortunately the patched system also corrupted my system. During e2fsck 
 run I found 626 lines of the form
 
 e2fsck 1.41.1 (01-Sep-2008)
 Pass 1: Checking inodes, blocks, and sizes
 Inode 3457228, i_blocks is 8, should be 16.  Fix<y>? yes
 [...]
 Inode 3457081, i_blocks is 16, should be 24.  Fix<y>? yes
 Inode 3457098, i_blocks is 8, should be 16.  Fix<y>? yes
 [...]
 Inode 3458451, i_blocks is 72, should be 80.  Fix<y>? yes
 [...]
 Inode 3458672, i_blocks is 32, should be 40.  Fix<y>? yes
 Inode 3458977, i_blocks is 8, should be 16.  Fix<y>? yes
 
 So, I could not see, that the suggested patch fixes the problems.
 
 --
 Bj?rn
 

From: Aditya Sarawgi <sarawgi.aditya@gmail.com>
To: bug-followup@freebsd.org
Cc: bjoern@cs.tu-berlin.de
Subject: Re: kern/104133: [ext2fs] EXT2FS module corrupts EXT2/3 filesystems
Date: Sun, 10 May 2009 20:35:18 +0530

 I have tried reproducing this bug by creating a partition with features similar to your partition. Then I did some heavy i/o operation on it but the 
 partition comes out clean. I even subjected it to postmark but it came out clean again. It would be nice to If anyone could reproduce this bug and 
 mail me the details.
 
 
 Cheers,
 Aditya Sarawgi
Responsible-Changed-From-To: freebsd-bugs->freebsd-fs 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon May 18 04:32:14 UTC 2009 
Responsible-Changed-Why:  
Over to maintainer(s). 

http://www.freebsd.org/cgi/query-pr.cgi?pr=104133 
State-Changed-From-To: feedback->open 
State-Changed-By: jilles 
State-Changed-When: Sat Jul 4 22:12:13 UTC 2009 
State-Changed-Why:  
Requested feedback has been received. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=104133 
State-Changed-From-To: open->closed 
State-Changed-By: pfg 
State-Changed-When: Sat Jan 11 01:05:03 UTC 2014 
State-Changed-Why:  
We have never supported extended attributes in ext2/3. 
Linux seems to have made changes several times in the support of extended  
attributes and our current ext2fs implementation has also been improved. 
This strange problem should not happen in newer FreeBSD (9.2+). 


http://www.freebsd.org/cgi/query-pr.cgi?pr=104133 
>Unformatted:
