Subject: Re: ext2fs support broken in -current
To: Kevin Lahey <kml@patheticgeek.net>
From: Kevin Lahey <kml@patheticgeek.net>
List: current-users
Date: 12/03/2004 12:29:57
I found that I could trigger the assert at the bottom of 
ext2fs_readwrite.c:

        KASSERT(vp->v_size == ip->i_e2fs_size);

All I had to do was a mkdir(1) on an ext2 filesystem, and then 
mv(1) that directory up one level.  It looks like the v_size
needed to be set when the i_e2fs_size was set.

I've appended my fix for it;  I don't doubt that there is a more 
elegant solution, but this appears to fix this problem, and I've 
been able to successfully use an ext2 filesystem for my home 
directory for at least a day now.

I also just send-pr'ed a problem with fsck_ext2fs, but this doesn't
seem to really mess with things, it just looks a little scary.

Kevin
kml@patheticgeek.net

Index: ext2fs_vnops.c
===================================================================
RCS file: /cvsroot/src/sys/ufs/ext2fs/ext2fs_vnops.c,v
retrieving revision 1.57
diff -c -r1.57 ext2fs_vnops.c
*** ext2fs_vnops.c	21 Sep 2004 03:10:35 -0000	1.57
--- ext2fs_vnops.c	3 Dec 2004 20:25:27 -0000
***************
*** 1117,1123 ****
  	if (VTOI(dvp)->i_e2fs->e2fs_bsize > dvp->v_mount->mnt_stat.f_bsize)
  		panic("ext2fs_mkdir: blksize"); /* XXX should grow with balloc() */
  	else {
! 		ip->i_e2fs_size = VTOI(dvp)->i_e2fs->e2fs_bsize;
  		ip->i_flag |= IN_CHANGE;
  	}
  
--- 1117,1123 ----
  	if (VTOI(dvp)->i_e2fs->e2fs_bsize > dvp->v_mount->mnt_stat.f_bsize)
  		panic("ext2fs_mkdir: blksize"); /* XXX should grow with balloc() */
  	else {
! 		tvp->v_size = ip->i_e2fs_size = VTOI(dvp)->i_e2fs->e2fs_bsize;
  		ip->i_flag |= IN_CHANGE;
  	}