Current-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: union mounts, mfs, and newsyslog
On Sun, Jul 5, 2009 at 11:07 PM, David
Holland<dholland-current%netbsd.org@localhost> wrote:
> On Sun, Jul 05, 2009 at 09:39:04PM -0400, matthew sporleder wrote:
> > if (rename(file1, file2))
> > err(EXIT_FAILURE, "%s", file1);
> > [...]
> >
> > /dev/wd0b /var/log_mfs mfs rw,hidden,-s10M 0 0
> > /var/log_mfs /var/log union rw - -
> >
> > So is it a limitation of mfs, union mounting, or my ffs?
>
> Unionfs has all kinds of problems, not least with rename. The short
> answer is "it's not really expected to work". Although in this
> particular case, I would have thought it would... or if not, fail some
> other way, like by crashing, instead of apparently passing vnodes from
> mismatched layers to one layer's VOP_RENAME.
>
> If you want to make it work, the first step is probably to figure out
> what it's doing: create a simple test case that exhibits the same
> behavior (this is not necessarily so trivial...) and then poke into
> the kernel to figure out what union_rename thinks it's doing.
>
> However... there are a number of more or less insoluble problems with
> rename and unionfs (in more complicated cases) and you might prefer
> not to get involved.
>
/* ren.c */
#include <stdio.h>
int main (int argc, char *argv[])
{
int ret;
ret = rename(argv[1], argv[2]);
ret == 0 ? : perror( "rename failed" );
return(ret);
}
gcc -o /var/tmp/ren ren.c
mkdir /var/upper
mkdir /var/lower
touch /var/upper/willpass
touch /var/lower/willfail
mount -t union /var/upper /var/lower
(results so far)
<above>:/var/upper 832508 758010 51823 93% /var/lower
fester# ls -l /var/lower
total 0
-rw-r--r-- 1 root wheel 0 Jul 6 22:21 willfail
-rw-r--r-- 1 root wheel 0 Jul 6 22:21 willpass
... (back to the action)
/var/tmp/ren willpass pass
/var/tmp/ren willfail fail
rename failed: Cross-device link
(final results)
fester# ls -l /var/lower
total 0
-rw-r--r-- 1 root wheel 0 Jul 6 22:21 pass
-rw-r--r-- 1 root wheel 0 Jul 6 22:21 willfail
I guess when a rename is passed to the lower layer it should be turned
into a copy at the upper layer and then a rename.
Sorry this isn't in atf,
Matt
Home |
Main Index |
Thread Index |
Old Index