Subject: Re: kern/26823: FFS_EI problems
To: Michael L. Hitch <mhitch@lightning.msu.montana.edu>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: netbsd-bugs
Date: 10/30/2004 16:43:38
On Fri, Oct 29, 2004 at 07:34:16PM -0600, Michael L. Hitch wrote:
> I had just experienced this same problem when trying to get NetBSD
> partitions on an amiga disk to mount on a Decstation.  I started sticking
> in some debug printfs here and there and found out what was happening.
> The filesystem gets mounted fine, with all the superblock stuff swapped,
> but no disk inodes were getting swapped.
> 
> Further investigation shows that the FS_SWAPPED bit in fs_flags was not
> getting set (well, actually it was getting set, but then getting cleared).
> The problem is that FS_SWAPPED is set after the superblock values are
> swapped, but then ffs_oldfscompat_read() copies fs_old_flags over fs_flags
> and the FS_SWAPPED bit is lost.
> 
> I tested a couple of different ways to fix this.  One was to set the
> FS_SWAPPED bit later in the code where UFS_NEEDSWAP gets set in
> ump->um_flags (inside an existing #ifdef FFS_EI).  A second was was to
> keep the bits in fs_flags masked by FS_INTENAL merged with the
> fs_old_flags in ffs_oldfscompat_read().

I think the second is the way to go. FS_INTENAL flags will by definition never
appear in on-disk structures, so preserving them when reading on-disk
structures looks right.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--