From owner-freebsd-bugs@FreeBSD.ORG Tue Oct 24 15:20:28 2006 Return-Path: X-Original-To: freebsd-bugs@hub.freebsd.org Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6521D16A403 for ; Tue, 24 Oct 2006 15:20:28 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6A9B543D7D for ; Tue, 24 Oct 2006 15:20:25 +0000 (GMT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.13.4/8.13.4) with ESMTP id k9OFKPDd093865 for ; Tue, 24 Oct 2006 15:20:25 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.13.4/8.13.4/Submit) id k9OFKPIU093864; Tue, 24 Oct 2006 15:20:25 GMT (envelope-from gnats) Date: Tue, 24 Oct 2006 15:20:25 GMT Message-Id: <200610241520.k9OFKPIU093864@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Bjoern Voigt Cc: Subject: Re: kern/104133: [ext2fs] EXT2FS module corrupts EXT2/3 filesystems X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: Bjoern Voigt List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Oct 2006 15:20:28 -0000 The following reply was made to PR kern/104133; it has been noted by GNATS. From: Bjoern Voigt To: freebsd-gnats-submit@FreeBSD.org Cc: Bruce Evans 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: Last mounted on: 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