From nobody@FreeBSD.org  Sun Jun 15 20:29:19 2008
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0B9F11065670
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 15 Jun 2008 20:29:19 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id EFEE38FC0C
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 15 Jun 2008 20:29:18 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.2/8.14.2) with ESMTP id m5FKTIdX075504
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 15 Jun 2008 20:29:18 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.2/8.14.1/Submit) id m5FKTIOD075503;
	Sun, 15 Jun 2008 20:29:18 GMT
	(envelope-from nobody)
Message-Id: <200806152029.m5FKTIOD075503@www.freebsd.org>
Date: Sun, 15 Jun 2008 20:29:18 GMT
From: Paul Floyd <paulf@free.fr>
To: freebsd-gnats-submit@FreeBSD.org
Subject: Cannot mount ext2fs partition
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         124621
>Category:       kern
>Synopsis:       [ext3] [patch] Cannot mount ext2fs partition
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-fs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sun Jun 15 20:30:01 UTC 2008
>Closed-Date:    Wed Dec 15 18:18:08 UTC 2010
>Last-Modified:  Wed Dec 15 18:18:08 UTC 2010
>Originator:     Paul Floyd
>Release:        7.0p1
>Organization:
n/a
>Environment:
FreeBSD bisanne.orange.fr 7.0-RELEASE FreeBSD 7.0-RELEASE #0: Sun Feb 24 19:59:52 UTC 2008     root@logan.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
Fedora 9 (and perhaps other distros) has changed ext2fs in a way that is not backwards compatible (changing the inode size from 128bytes to 256bytes). This renders ext2fs partitions unmountable by FreeBSD.
>How-To-Repeat:
Install Fedora 9 and les the installer format its destination partition as ext3
>Fix:
Formatted the partition with gparted (under debian etch) prior to running the Fedora 9 installer, and made sure to not format the partition during the installation.

>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-i386->freebsd-fs 
Responsible-Changed-By: gavin 
Responsible-Changed-When: Mon Jun 16 00:03:20 UTC 2008 
Responsible-Changed-Why:  
This doesn't sound -i386 specific 

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

From: "Josh Carroll" <josh.carroll@gmail.com>
To: bug-followup@FreeBSD.org, paulf@free.fr
Cc:  
Subject: Re: kern/124621: [ext3] Cannot mount ext2fs partition
Date: Wed, 3 Sep 2008 14:28:58 -0400

 Here is a simple patch that queries the inode size, rather than assuming 128.
 
 This may be a rather naive way to do this (querying it every time from
 (s)->s_es->s_inode_size), but it does seem to work. Perhaps there is a
 smarter way of doing this (setting something at mount time?).
 
 I tested this with mke2fs -I 128, mke2fs (defaults to -I 256 with the
 latest e2fsprogs port), and -I 512.
 
 Thanks,
 Josh
 
 
 diff -ud ext2fs.orig/ext2_fs.h ext2fs/ext2_fs.h
 --- ext2fs.orig/ext2_fs.h       2005-06-16 06:51:38.000000000 +0000
 +++ ext2fs/ext2_fs.h    2008-09-03 14:10:27.000000000 +0000
 @@ -150,7 +150,7 @@
  #else /* !notyet */
  #define        EXT2_INODES_PER_BLOCK(s)        ((s)->s_inodes_per_block)
  /* Should be sizeof(struct ext2_inode): */
 -#define EXT2_INODE_SIZE                        128
 +#define EXT2_INODE_SIZE(s)             ((s)->s_es->s_inode_size)
  #define EXT2_FIRST_INO                 11
  #endif /* notyet */
 
 diff -ud ext2fs.orig/ext2_inode.c ext2fs/ext2_inode.c
 --- ext2fs.orig/ext2_inode.c    2006-09-26 04:15:58.000000000 +0000
 +++ ext2fs/ext2_inode.c 2008-09-03 13:54:49.000000000 +0000
 @@ -91,7 +91,7 @@
                 return (error);
         }
         ext2_i2ei(ip, (struct ext2_inode *)((char *)bp->b_data +
 -           EXT2_INODE_SIZE * ino_to_fsbo(fs, ip->i_number)));
 +           EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)));
         if (waitfor && (vp->v_mount->mnt_kern_flag & MNTK_ASYNC) == 0)
                 return (bwrite(bp));
         else {
 diff -ud ext2fs.orig/ext2_vfsops.c ext2fs/ext2_vfsops.c
 --- ext2fs.orig/ext2_vfsops.c   2008-04-03 18:51:13.000000000 +0000
 +++ ext2fs/ext2_vfsops.c        2008-09-03 13:55:37.000000000 +0000
 @@ -424,7 +424,7 @@
      V(s_frags_per_group)
      fs->s_inodes_per_group = es->s_inodes_per_group;
      V(s_inodes_per_group)
 -    fs->s_inodes_per_block = fs->s_blocksize / EXT2_INODE_SIZE;
 +    fs->s_inodes_per_block = fs->s_blocksize / EXT2_INODE_SIZE(fs);
      V(s_inodes_per_block)
      fs->s_itb_per_group = fs->s_inodes_per_group /fs->s_inodes_per_block;
      V(s_itb_per_group)
 @@ -578,7 +578,7 @@
                         return (error);
                 }
                 ext2_ei2i((struct ext2_inode *) ((char *)bp->b_data +
 -                   EXT2_INODE_SIZE * ino_to_fsbo(fs, ip->i_number)), ip);
 +                   EXT2_INODE_SIZE(fs) * ino_to_fsbo(fs, ip->i_number)), ip);
                 brelse(bp);
                 VOP_UNLOCK(vp, 0, td);
                 vrele(vp);
 @@ -1013,7 +1013,7 @@
                 return (error);
         }
         /* convert ext2 inode to dinode */
 -       ext2_ei2i((struct ext2_inode *) ((char *)bp->b_data + EXT2_INODE_SIZE *
 +       ext2_ei2i((struct ext2_inode *) ((char *)bp->b_data +
 EXT2_INODE_SIZE(fs) *
                         ino_to_fsbo(fs, ino)), ip);
         ip->i_block_group = ino_to_cg(fs, ino);
         ip->i_next_alloc_block = 0;

From: "Josh Carroll" <josh.carroll@gmail.com>
To: bug-followup@FreeBSD.org, paulf@free.fr
Cc:  
Subject: Re: kern/124621: [ext3] Cannot mount ext2fs partition
Date: Thu, 4 Sep 2008 13:16:55 -0400

 ------=_Part_61122_6937983.1220548615546
 Content-Type: text/plain; charset=ISO-8859-1
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline
 
 Sorry, it appears the previous patch was munged by gmail.
 
 I'm trying it as an attachment this time. I apologize in advance if
 this attempt is also munged.
 
 Josh
 
 ------=_Part_61122_6937983.1220548615546
 Content-Type: application/octet-stream; name=ext2fs.diff
 Content-Transfer-Encoding: base64
 X-Attachment-Id: f_fkpn4bhq0
 Content-Disposition: attachment; filename=ext2fs.diff
 
 ZGlmZiAtdWQgZXh0MmZzLm9yaWcvZXh0Ml9mcy5oIGV4dDJmcy9leHQyX2ZzLmgKLS0tIGV4dDJm
 cy5vcmlnL2V4dDJfZnMuaAkyMDA1LTA2LTE2IDA2OjUxOjM4LjAwMDAwMDAwMCArMDAwMAorKysg
 ZXh0MmZzL2V4dDJfZnMuaAkyMDA4LTA5LTAzIDE0OjEwOjI3LjAwMDAwMDAwMCArMDAwMApAQCAt
 MTUwLDcgKzE1MCw3IEBACiAjZWxzZSAvKiAhbm90eWV0ICovCiAjZGVmaW5lCUVYVDJfSU5PREVT
 X1BFUl9CTE9DSyhzKQkoKHMpLT5zX2lub2Rlc19wZXJfYmxvY2spCiAvKiBTaG91bGQgYmUgc2l6
 ZW9mKHN0cnVjdCBleHQyX2lub2RlKTogKi8KLSNkZWZpbmUgRVhUMl9JTk9ERV9TSVpFCQkJMTI4
 CisjZGVmaW5lIEVYVDJfSU5PREVfU0laRShzKQkJKChzKS0+c19lcy0+c19pbm9kZV9zaXplKQog
 I2RlZmluZSBFWFQyX0ZJUlNUX0lOTwkJCTExCiAjZW5kaWYgLyog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wLT5iX2RhdGEgKyBFWFQyX0lOT0RFX1NJWkUoZnMpICoKIAkJCWlub190b19mc2JvKGZz
 LCBpbm8pKSwgaXApOwogCWlwLT5pX2Jsb2NrX2dyb3VwID0gaW5vX3RvX2NnKGZzLCBpbm8pOwog
 CWlwLT5pX25leHRfYWxsb2NfYmxvY2sgPSAwOwo=
 ------=_Part_61122_6937983.1220548615546--

From: "Josh Carroll" <josh.carroll@gmail.com>
To: bug-followup@FreeBSD.org, paulf@free.fr
Cc:  
Subject: Re: kern/124621: [ext3] Cannot mount ext2fs partition
Date: Thu, 4 Sep 2008 13:42:36 -0400

 Sigh. Apologies again.
 
 Let's try it this way. Here is the patch:
 
 http://pflog.net/~floyd/ext2fs.diff
 
 Thanks,
 Josh

From: Wesley Shields <wxs@FreeBSD.org>
To: bug-followup@FreeBSD.org
Cc: josh.carroll@gmail.com
Subject: Re: kern/124621: [ext3] Cannot mount ext2fs partition
Date: Thu, 4 Sep 2008 13:50:07 -0400

 From reading of the release notes it looks like this change was made in
 January 2008.
 
 http://e2fsprogs.sourceforge.net/e2fsprogs-release.html#1.40.10
 
 I tested the patch that is online from Josh and it works.  Is anyone
 willing to step up and commit this?  Seems like a simple enough fix and
 will start to hit more and more people as updated versions of e2fsprogs
 becomes more common.
 
 Thanks, Josh, for providing a fix for this.
 
 -- WXS

From: "Helio Loureiro" <helio@loureiro.eng.br>
To: bug-followup@freebsd.org, paulf@free.fr
Cc:  
Subject: Re: kern/124621: [ext3] [patch] Cannot mount ext2fs partition
Date: Mon, 12 Jan 2009 14:34:16 -0200

 Hi,
 
 I'm facing the same issue.  I have an external HD, where I installed
 Linux Ubuntu a long time ago.  I performed recently an upgrade to
 latest Ubuntu, what reformatted partition da0s1.  Old partitions, like
 da0s2 (home), remain working fine w/ FreeBSD.
 
 I checked Inode size paramenter in both:
 
 musashi# tune2fs -l /dev/da0s1 | grep -i "inode size"
 Inode size:               256
 musashi# tune2fs -l /dev/da0s2 | grep -i "inode size"
 Inode size:               128
 
 I'm using the e2fsprogs version you recommended, 1.41.0, in a FreeBSD-7.1:
 
 musashi# pkg_glob "*e2fs*"
 e2fsprogs-1.41.0
 musashi# uname -a
 FreeBSD musashi.br.am.ericsson.se 7.1-RELEASE FreeBSD 7.1-RELEASE #23:
 Sat Jan  3 23:41:26 BRST 2009
 root@musashi.br.am.ericsson.se:/usr/obj/usr/src/sys/MUSASHI  i386
 
 
 So programs like fsck.ext3 are working fine, finding and checking filesyste=
 ms:
 
 e2fsck 1.41.0 (10-Jul-2008)
 /dev/da0s1: clean, 130703/305824 files, 796572/1220932 blocks
 musashi# /usr/local/sbin/fsck.ext3 /dev/da0s2
 e2fsck 1.41.0 (10-Jul-2008)
 /dev/da0s2: clean, 219500/12222464 files, 21270465/24414783 blocks
 
 So da0s1 isn't accessible while da0s2 is:
 
 musashi# mkdir /mnt/da0s{1,2}
 musashi# mount_ext2fs /dev/da0s1 /mnt/da0s1
 musashi# mount_ext2fs /dev/da0s2 /mnt/da0s2
 musashi# ls /mnt/da0s1
 ls: /mnt/da0s1: Bad file descriptor
 musashi# ls /mnt/da0s2
 backup          fotos           helio           lost+found      tmp
          x
 
 I even tried to unload/load ext2fs.ko module, but I didn't see any
 progress on that.
 
 So I believe the issue is reproducible and remains despite the new
 e2fsprogs release.
 
 I'll try the suggested patch and see if it works.
 --=20
 []=B4s
 Helio Loureiro
State-Changed-From-To: open->feedback 
State-Changed-By: stas 
State-Changed-When: Sun Jan 18 17:26:15 UTC 2009 
State-Changed-Why:  
Ask for submitter test. 

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

From: Stanislav Sedov <stas@FreeBSD.org>
To: Paul Floyd <paulf@free.fr>
Cc: bug-followup@FreeBSD.org
Subject: Re: kern/124621: [ext3] [patch] Cannot mount ext2fs partition
Date: Sun, 18 Jan 2009 20:23:22 +0300

 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
 Hi, Paul!
 
 Can you check, please, if recent current suffers from the same
 problem? The patch I've committed today should solve this issue.
 I can give you a patch for 7.1 if you're in position to rebuild
 the kernel.
 
 Thanks!
 - -- 
 Stanislav Sedov
 ST4096-RIPE
 -----BEGIN PGP SIGNATURE-----
 
 iEYEARECAAYFAklzZYoACgkQK/VZk+smlYGE/ACdE+ybZzJxb/5Nb1Qi1CyILVtW
 6aAAnieoGkMpBCoFvwKAE1yVWgxu5pbA
 =Nn7G
 -----END PGP SIGNATURE-----
 
 !DSPAM:49736588967004808450424!
 
 

From: "James E. Flemer" <jflemer@alum.rpi.edu>
To: paulf@free.fr, bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/124621: [ext3] [patch] Cannot mount ext2fs partition
Date: Fri, 3 Jul 2009 19:23:53 -0700

 Environment:
 FreeBSD cage.local 7.1-STABLE FreeBSD 7.1-STABLE #1: Thu Jan  8
 20:10:28 PST 2009
 root@cage.local:/mnt/space/usr/obj.i386/mnt/space/usr/src/sys/CAGE7-SMP
  i386
 
 Just another data point, the patch
 (http://pflog.net/~floyd/ext2fs.diff,
 md5:3dd5125eeb591e9c53930beb216d523e) fixes mounting a ext3 partition
 from an Ubuntu 9.4 install.  Confirmed with tune2fs that the partition
 has 256-byte inode size.  Tested by applying patch and rebuilding in
 /usr/src/sys/modules/ext2fs.
State-Changed-From-To: feedback->patched 
State-Changed-By: jh 
State-Changed-When: Sat Oct 31 14:41:11 UTC 2009 
State-Changed-Why:  
Patched in head / stable/8 by r187395 and in stable/7 by r194495. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=124621 
State-Changed-From-To: patched->closed 
State-Changed-By: jh 
State-Changed-When: Wed Dec 15 18:18:06 UTC 2010 
State-Changed-Why:  
Fixed in all supported branches. 

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