From owner-freebsd-current Fri Feb 26 18:49:20 1999 Delivered-To: freebsd-current@freebsd.org Received: from server.noc.demon.net (server.noc.demon.net [193.195.224.4]) by hub.freebsd.org (Postfix) with ESMTP id C1D4B15045 for ; Fri, 26 Feb 1999 18:49:15 -0800 (PST) (envelope-from fanf@demon.net) Received: by server.noc.demon.net; id CAA14895; Sat, 27 Feb 1999 02:48:58 GMT Received: from fanf.noc.demon.net(195.11.55.83) by inside.noc.demon.net via smap (3.2) id xma014882; Sat, 27 Feb 99 02:48:49 GMT Received: from fanf by fanf.noc.demon.net with local (Exim 1.73 #2) id 10GZo8-0003Ko-00; Sat, 27 Feb 1999 02:48:48 +0000 From: Tony Finch To: current@freebsd.org Subject: Re: mount -o union broken recently? In-Reply-To: <199902262016.VAA26475@labinfo.iet.unipi.it> References: Message-Id: Date: Sat, 27 Feb 1999 02:48:48 +0000 Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Luigi Rizzo 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