NetBSD Problem Report #10235

Received: (qmail 29396 invoked from network); 30 May 2000 15:35:28 -0000
Message-Id: <20000530153512.840BFDD@proven.weird.com>
Date: Tue, 30 May 2000 11:35:12 -0400 (EDT)
From: woods@weird.com (Greg A. Woods)
Sender: woods@proven.weird.com
Reply-To: woods@planix.com (Greg A. Woods)
To: gnats-bugs@gnats.netbsd.org
Subject: null (loop-back) fs mounted over NFS leaves .nfs* files untouchable
X-Send-Pr-Version: 3.95

>Number:         10235
>Category:       kern
>Synopsis:       null (loop-back) fs mounted over NFS leaves .nfs* files untouchable
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue May 30 15:36:00 +0000 2000
>Closed-Date:    Sun Dec 03 03:59:35 +0000 2006
>Last-Modified:  Sun Dec 03 03:59:35 +0000 2006
>Originator:     Greg A. Woods
>Release:        Mon Mar 20 09:47:15 EST 2000
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:

System: NetBSD 1.4V i386

>Description:

	I have a loop-back mount using the "null" fs layer to facilitate
	getting an NFS filesystem into the right point for a chroot'ed
	application (ftpd).

	When I create new files and directories in the loopback view of
	the filesystem I cannot immediately remove the new
	sub-directories because .nfs* files are created for each new
	file which cannot be removed from either the loopback layer
	view, or the NFS mount point view.

	This does not happen when the same operations are done within
	the NFS mount point.  Given the comments received on
	current-users I suspect this problem is due to some nasty tricks
	the NFS filesystem might be playing behind the null filesystem's
	back.

>How-To-Repeat:

	# create the scenario described above

	$ /sbin/mount
	/dev/sd0a on / type ffs (NFS exported, local)
	/dev/sd0e on /var type ffs (NFS exported, local)
	/dev/sd1a on /altroot type ffs (NFS exported, local)
	/dev/sd4h on /backups type ffs (local)
	/dev/sd1e on /tmp type ffs (NFS exported, local)
	/dev/sd0f on /cvs type ffs (local)
	/dev/sd1f on /opt type ffs (NFS exported, local)
	/dev/sd2h on /work type ffs (NFS exported, local)
	most.weird.com:/big1 on /most/big1 type nfs
	most.weird.com:/netbsd-1.4 on /most/netbsd-1.4 type nfs
	most.weird.com:/spare on /most/spare type nfs
	most.weird.com:/var on /most/var type nfs
	kernfs on /kern type kernfs (local)
	procfs on /proc type procfs (local)
	fdesc on /fdesc type fdesc (local)
	/most/var/spool/ftp/pub on /var/spool/ftp/pub type null

	# go into the loopback view and create some new files and
	# directories; by unpacking a tar file, for example

	$ cd /var/spool/ftp/pub/mirror
	$ pax -rzf somearchive.tar.gz
	$ rm -rf somearchive

	# observe "rm" complain about "Directory not empty" for ever
	# directory created by the unpacked archive

	$ ls -la somearchive
	[[ lots of .nfs* files not shown here ]]

	# observe that there are .nfs* files remaining in the new
	# subdirectories that cannot be removed from the loopback
	# hierarchy.

	# now go and try to remove them from the NFS view

	$ cd /most/var/spool/ftp/pub/mirror/somearchive
	$ rm -f .nfs*
	$ ls -la
	[[ lots of .nfs* files not shown here ]]

	# note that rm doesn't complain about not being able to remove
	# the files (unlink() must be returning success), but that they
	# are still there....

	# now prove that from the NFS view all is well:

	$ cd /most/var/spool/ftp/pub/mirror
	$ pax -rzf someotherarchive.tar.gz
	$ rm -rf someotherarchive
	$ ls -la someotherarchive
	ls: someotherarchive: No such file or directory

	# also observe that "df" sees right through the loopback layer
	# when maybe it should not:

	$ df /var/spool/ftp/pub
	Filesystem              512-blocks     Used    Avail Capacity  Mounted on
	/most/var/spool/ftp/pub    2819610  2358416   320212    88%    /var/spool/ftp/pub

>Fix:

	none known (rewrite the NFS filesystem "properly"? :-)
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed
State-Changed-By: chs@netbsd.org
State-Changed-When: Sun, 03 Dec 2006 03:59:35 +0000
State-Changed-Why:
somewhat fixed by this change:

Module Name:	src
Committed By:	wrstuden
Date:		Fri May 28 18:55:20 UTC 2004

Modified Files:
	src/sys/miscfs/genfs: layer.h layer_extern.h layer_vnops.c
	src/sys/miscfs/nullfs: null_vnops.c
	src/sys/miscfs/overlay: overlay_vnops.c
	src/sys/miscfs/umapfs: umap_vnops.c

Log Message:
Since VOP_UPCALL() has been a long time in coming, add this partial
fix for layered-file-removal. It will work for the case of accessing
and deleting a file through the layered file system. Accessing via
the layer and deleting on the underlying still won't work, nor will
accessing via complicated structures (like two umap layers over a
given file systems).

We still need VOP_UPCALL(), but this is better than things were before.

This patch has been discussed off & on for a while. This incarnation
was tested by hannken at netbsd dot org.


To generate a diff of this commit:
cvs rdiff -r1.5 -r1.6 src/sys/miscfs/genfs/layer.h
cvs rdiff -r1.13 -r1.14 src/sys/miscfs/genfs/layer_extern.h
cvs rdiff -r1.15 -r1.16 src/sys/miscfs/genfs/layer_vnops.c
cvs rdiff -r1.28 -r1.29 src/sys/miscfs/nullfs/null_vnops.c
cvs rdiff -r1.11 -r1.12 src/sys/miscfs/overlay/overlay_vnops.c
cvs rdiff -r1.25 -r1.26 src/sys/miscfs/umapfs/umap_vnops.c


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.