Discussion:
nullfs: contents under mount point not visible via null mount
Toby Karyadi
2014-09-08 17:44:28 UTC
Permalink
Hi,

Say, if I have the following:
- a path a/b/c/d
- a/b/c/d is a mount point for some filesystem
- an alternate path alt-hier/c, which is a null mount for a/b/c

Then, listing alt-hier/c/d won't show the content of the filesystem
mounted on a/b/c/d. This is surprising, since I thought that I'd see the
content of a/b/c/d. Is this a bug, or my misunderstanding of how the
nullfs is supposed to work? I also tried this on FreeBSD 7.1 and got the
same behavior; hmmpfh.

Anyone?

Thanks,
Toby

PS:
The following shows what I meant in a pseudo trace/sh

# mkdir testdir
# cd testdir
# mkdir -p a/b/c/d
# # Now create some test fs.
# dd if=/dev/zero of=d-data.img bs=1m count=4
# # Find a free vnd device
# vnconfig -l
vnd0: not in use
vnd1: not in use
vnd2: not in use
vnd3: not in use
# vnconfig vnd0 d-data.img
# newfs /dev/rvnd0a
# mount /dev/vnd0a a/b/c/d
# (cd a/b/c/d && touch d1 d2 d3)
# ls a/b/c/d
d1 d2 d3
# # Now create the null mount point
# mkdir -p alt-hier/c
# mount -t null $(pwd)/a/b/c alt-hier/c
# ls alt-hier/c/d
#
# # What? I'm expecting same result as 'ls a/b/c/d'
#
# # Alright, let's cleanup
# umount alt-hier/c
# umount a/b/c/d
# vnconfig -u vnd0
# cd ..
# # rm -rf testdir
Eric Haszlakiewicz
2014-09-08 21:56:32 UTC
Permalink
Post by Toby Karyadi
Hi,
- a path a/b/c/d
- a/b/c/d is a mount point for some filesystem
- an alternate path alt-hier/c, which is a null mount for a/b/c
Then, listing alt-hier/c/d won't show the content of the filesystem
mounted on a/b/c/d. This is surprising, since I thought that I'd see the
content of a/b/c/d. Is this a bug, or my misunderstanding of how the
nullfs is supposed to work? I also tried this on FreeBSD 7.1 and got the
same behavior; hmmpfh.
Based on the description in the man page, notably that it says that null mounts work on the overall namespace, it seems like that should work. I'd say what you're seeing is a bug.
Maybe it only figures out the filesystem of the lower layer at mount time, not at each vnode lookup?

Eric
Rhialto
2014-09-08 21:58:10 UTC
Permalink
Post by Toby Karyadi
- a path a/b/c/d
- a/b/c/d is a mount point for some filesystem
- an alternate path alt-hier/c, which is a null mount for a/b/c
Then, listing alt-hier/c/d won't show the content of the filesystem mounted
on a/b/c/d. This is surprising, since I thought that I'd see the content of
a/b/c/d. Is this a bug, or my misunderstanding of how the nullfs is supposed
to work? I also tried this on FreeBSD 7.1 and got the same behavior; hmmpfh.
I believe that is a general effect. You'd see it with NFS too: if you
export a/b/c to some client, it will not see whatever the server has
mounted on a/b/c/d.

You can always do an extra null mount on alt-hier/c/d, which is the same
solution as for NFS.

The reasoning is, I think, that a/b/c/d is a different file system from
a/b/c, and hence it is not included in the nfs export or null re-mount
(which is also a file system export of a kind).

-Olaf.
--
___ Olaf 'Rhialto' Seibert -- The Doctor: No, 'eureka' is Greek for
\X/ rhialto/at/xs4all.nl -- 'this bath is too hot.'
Eric Haszlakiewicz
2014-09-09 16:41:05 UTC
Permalink
Post by Toby Karyadi
Post by Toby Karyadi
- a path a/b/c/d
- a/b/c/d is a mount point for some filesystem
- an alternate path alt-hier/c, which is a null mount for a/b/c
Then, listing alt-hier/c/d won't show the content of the filesystem
mounted
Post by Toby Karyadi
on a/b/c/d. This is surprising, since I thought that I'd see the
content of
Post by Toby Karyadi
a/b/c/d. Is this a bug, or my misunderstanding of how the nullfs is
supposed
Post by Toby Karyadi
to work? I also tried this on FreeBSD 7.1 and got the same behavior;
hmmpfh.
I believe that is a general effect. You'd see it with NFS too: if you
export a/b/c to some client, it will not see whatever the server has
mounted on a/b/c/d.
Except that with NFS you export a *filesystem*, while nullfs talks about mapping a portion of the *namespace* instead.
If the man page is an accurate representation of how it's supposed to work, then all mounted filesystems should show up. If not, then the man page could use some clarification.

Eric
Ilia Zykov
2014-09-09 22:08:13 UTC
Permalink
Hello!
* This makes the following assumptions:
* - only one returned vpp
* - no INOUT vpp's (Sun's vop_open has one of these)
* - the vnode operation vector of the first vnode should be used
* to determine what implementation of the op should be invoked
* - all mapped vnodes are of our vnode-type (NEEDSWORK:
* problems on rmdir'ing mount points and renaming?)
*/

Layerfs doesn't use a vnode->v_mountedhere field.
Because it can't easy control the root vnode of mounted fs,
And maybe shouldn't.
Ilia.

Loading...