Bug 162591 - [nullfs] cross-filesystem nullfs does not work as expected
Summary: [nullfs] cross-filesystem nullfs does not work as expected
Status: Closed Works As Intended
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: Unspecified
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-15 18:50 UTC by Moritz Wilhelmy
Modified: 2018-12-18 21:49 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Moritz Wilhelmy 2011-11-15 18:50:06 UTC
 mounting a tree with mount_nullfs does not work as expected if the
 filesystem has other nullfs filesystems mounted below. The files from the tree
 itself show up, but not the files from mountpoints under the tree. See below for
 an example.
 Expected behaviour would be that all mountpoints from the nullfs mount show up
 on the tree that it's mounted on.

Fix: 

Unknown
How-To-Repeat:  My original use-case:
  # mkdir -p testdir shares/testdir somejail/shares
  # touch testdir/{moo,cow}
  # ls testdir
  cow moo
  # mount_nullfs -o ro testdir shares/testdir
  # mount_nullfs -o ro shares somejail/shares
  # ls shares/testdir/
  cow moo
  # ls somejail/shares/testdir/
  # ^^^^ no files here
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2011-11-21 00:01:18 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 2 Gleb Kurtsou 2011-11-21 14:23:47 UTC
That is expected behaviour, according to mount_nullfs(8):
	The mount_nullfs utility creates a null layer, duplicating a
	sub-tree of the file system name space under another part of the
	global file system namespace.

It mentions sub-tree of a single file system only. nullfs is technically
very different from loop mounts in Linux or nullfs in DragonFly, it
doesn't map part of file name space elsewhere, but duplicates file
system sub-tree.

Messing with v_mountedhere in nullfs would bring much more trouble than
it can potentially solve: VFS_VGET(), full path lookups, etc.  We could
add mount option to automatically nullfs-mount nested mounts, but it
also feels overcomplicated: unmounting may be difficult, should we track
new mounts, etc. Mounting nullfs over nullfs is a very bad idea imo (it
it's not forbidden, I'd also suggest not to NFS export nullfs).

I think writing a small script to do nested mounts/unmounts that suites
your needs would be the best option here.
Comment 3 moritz 2013-08-31 16:46:06 UTC
On Mon, Nov 21, 2011 at 16:23:47 +0200, Gleb Kurtsou wrote:
> That is expected behaviour, according to mount_nullfs(8):
-snip-

Alright. Care to close the PR then?

> I think writing a small script to do nested mounts/unmounts that suites
> your needs would be the best option here.

That's what I've done. Thanks!
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2017-12-31 07:59:54 UTC
For bugs matching the following criteria:

Status: In Progress Changed: (is less than) 2014-06-01

Reset to default assignee and clear in-progress tags.

Mail being skipped
Comment 5 Andriy Voskoboinyk freebsd_committer freebsd_triage 2018-12-18 21:49:16 UTC
As I can see in comment #3, the problem seems to be resolved.