Subject: Re: Unionfs write problem with RO bottom layer.
To: Thor Lancelot Simon <tls@rek.tjls.com>
From: Martin S. Weber <Ephaeton@gmx.net>
List: tech-kern
Date: 11/28/2007 13:24:53
On Tue, Nov 27, 2007 at 08:08:49PM -0500, Thor Lancelot Simon wrote:
> (...)
> To reproduce:
> 
> 1) Mount /l0 read-write
> 2) touch /l0/foo
> 3) Remount /l0 read-only
> 4) Mount /l1 read-write
> 4) Union mount /l1 over /l0: mount_union /l1 /l0
> 5) cat > /l0/foo or cat >> /l0/foo (either will fail with EROFS).
> (...)
>
> (...)the actual VOP_OPEN is tried but this appears to have been broken since
> at least 3.0.  I think access() on unionfs with a RO bottom layer has
> _always_ been broken.


It is, imho because it initializes the union vnodes in a wrong way,
effectively nulling permissions et al instead of copying them up
from the lower layer.

We do have some problems with our LiveCD which does a r/o mount of a
vncompress'd image on a CD-Rom and then attaches union mounts on top
but with a little patch (copying vnode attributes from lower to upper)
we're mostly happy here. Only thing making us unhappy is that I (yes me)
accidentally rm'd it (the patch). Yay.

Anyways, I've edited, appended to or whatever more than one file which
really lives in r/o land via mount-union. Actually anything writable
on our livecd uses writing-on-r/o. We create, delete, append to files.
 I.e. did the equivalent of 5). And it worked
(under nbsd-4). So I cannot agree with "it's broken since 3.0 at least".

I gotta redo the patches I mentioned and still offer 'em here for review, sigh...

-Martin