Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 27 Feb 1999 02:48:48 +0000
From:      Tony Finch <dot@dotat.at>
To:        current@freebsd.org
Subject:   Re: mount -o union broken recently?
Message-ID:  <E10GZo8-0003Ko-00@fanf.noc.demon.net>
In-Reply-To: <199902262016.VAA26475@labinfo.iet.unipi.it>
References:  <E10GNQx-0002lU-00@fanf.noc.demon.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Luigi Rizzo <luigi@labinfo.iet.unipi.it> wrote:
>
>(about union mounts on 3.1 not returning all files with an 'ls' in
>3.1 while it did in 3.0)
>
>> Is it sorrect that this magic is implemented in sys/kern/vfs_lookup.c?
>> The odd thing is that AFAICS no-one has made significant changes to
>> this code.
>
>i just experienced the above today while trying diskless, and while
>ls only seems to return the entries for the topmost directory, files
>are accessible if you know the name. no idea if this is of any help.

This is exactly the right pointer, thanks! The problem appears to be
the change between revs 1.108 and 1.109 of sys/kern/vfs_syscalls.c. A
couple of (very similar) blocks of code related to `mount -o union`
seem to have been mixed up with some code related to `mount -t union`
and therefore removed. It's a shame that the two things get confused
so much. I originally missed vfs_syscalls.c because a `find
/usr/src/sys | xargs grep MNT_UNION` on 3.1 didn't show it. Replacing
the errant code fixes the problem. Here's a patch against 1.112.2.1.

Tony.
--
f.a.n.finch  dot@dotat.at  fanf@demon.net


--- vfs_syscalls.c.3.1	Sat Feb 27 02:15:13 1999
+++ vfs_syscalls.c	Sat Feb 27 02:30:42 1999
@@ -2763,6 +2763,17 @@
 		if (error)
 			return (error);
 	}
+	if ((SCARG(uap, count) == auio.uio_resid) &&
+	    (vp->v_flag & VROOT) &&
+	    (vp->v_mount->mnt_flag & MNT_UNION)) {
+		struct vnode *tvp = vp;
+		vp = vp->v_mount->mnt_vnodecovered;
+		VREF(vp);
+		fp->f_data = (caddr_t) vp;
+		fp->f_offset = 0;
+		vrele(tvp);
+		goto unionread;
+	}
 	error = copyout((caddr_t)&loff, (caddr_t)SCARG(uap, basep),
 	    sizeof(long));
 	p->p_retval[0] = SCARG(uap, count) - auio.uio_resid;
@@ -2828,6 +2839,17 @@
 			goto unionread;
 		if (error)
 			return (error);
+	}
+	if ((SCARG(uap, count) == auio.uio_resid) &&
+	    (vp->v_flag & VROOT) &&
+	    (vp->v_mount->mnt_flag & MNT_UNION)) {
+		struct vnode *tvp = vp;
+		vp = vp->v_mount->mnt_vnodecovered;
+		VREF(vp);
+		fp->f_data = (caddr_t) vp;
+		fp->f_offset = 0;
+		vrele(tvp);
+		goto unionread;
 	}
 	if (SCARG(uap, basep) != NULL) {
 		error = copyout((caddr_t)&loff, (caddr_t)SCARG(uap, basep),


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?E10GZo8-0003Ko-00>