Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 654204 - net-fs/nfs-utils-2.3.1-r3 - /etc/init.d/nfs should mkdir /proc/fs/nfsd before attempting to mount the nfsd filesystem
Summary: net-fs/nfs-utils-2.3.1-r3 - /etc/init.d/nfs should mkdir /proc/fs/nfsd before...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks:
 
Reported: 2018-04-27 18:25 UTC by nobody
Modified: 2018-05-01 23:44 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description nobody 2018-04-27 18:25:47 UTC
the directory /proc/fs/nfsd doesn't exist on a system that has not create it, prior to mount anything over it, the directory must exist



Reproducible: Always

Steps to Reproduce:
1.use an nfsd ready system
2.rm -rf /proc/fs/nfsd
3./etc/init.d/nfs start


Expected Results:  
mount_nfsd() {
	if [ -e /proc/modules ] ; then
change to
mount_nfsd() {
        [ ! -d /proc/fs/nfsd ] && mkdir -p /proc/fs/nfsd
	if [ -e /proc/modules ] ; then
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2018-04-28 10:37:21 UTC
(In reply to nobody from comment #0)
> the directory /proc/fs/nfsd doesn't exist on a system that has not create
> it, prior to mount anything over it, the directory must exist

What kind of system is that?

> Steps to Reproduce:
> 1.use an nfsd ready system
> 2.rm -rf /proc/fs/nfsd

How would this happen in any practical situation?
Comment 2 Mike Gilbert gentoo-dev 2018-04-29 16:54:15 UTC
It seems silly to safeguard against someone who removed the directory manually.
Comment 3 nobody 2018-04-30 12:00:44 UTC
It's not to protect against someone deleting the directory, that's an example to reproduce that's all.

You do realise we're speaking about /proc content? /proc is just an empty directory in stage3, it is fill by the kernel itself in a live system.

So user doesn't have to delete /proc/fs/nfsd ; /proc/fs exists only because kernel create it, but kernel doesn't create /proc/fs/nfsd it is up to the distro to create that anchor, with a name the distro is free to choose.
see https://bugs.gentoo.org/172019
Comment 4 nobody 2018-04-30 13:49:45 UTC
(In reply to Jeroen Roovers from comment #1)
> What kind of system is that?
It's just a system that has never create that directory, never had try to use nfsd with it ; like for any new gentoo installation
 
> How would this happen in any practical situation?
Same as upper, after someone try to use nfsd in his new installation.

Patch? I have move it to a more obvious location to why we should do that
--- nfs	2018-04-30 15:44:28.255394507 +0200
+++ nfs_new	2018-04-30 15:51:39.958997469 +0200
@@ -63,6 +63,7 @@
 	if grep -qs nfsd /proc/filesystems ; then
 		if ! mountinfo -q /proc/fs/nfsd ; then
 			ebegin "Mounting nfsd filesystem in /proc"
+			[ ! -d /proc/fs/nfsd ] && mkdir -p /proc/fs/nfsd
 			mount -t nfsd -o nodev,noexec,nosuid nfsd /proc/fs/nfsd
 			eend $?
 		fi
Comment 5 nobody 2018-04-30 13:53:44 UTC
It could be also done in nfs-utils.ebuild that would create the directory when someone install nfs-utils
Comment 6 Mike Gilbert gentoo-dev 2018-04-30 18:18:08 UTC
/proc is managed by the kernel. The sysadmin should never need to created directories there.

Does the kernel not create an empty /proc/fs/nfsd directory for you on bootup?
Comment 7 Mike Gilbert gentoo-dev 2018-04-30 18:29:46 UTC
The kernel has been creating fs/nfsd in procfs for many years; it predates the available history in git.

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/fs/proc/root.c?h=v2.6.12-rc2#n70

The only way you would run into this problem is if you fail to mount procfs on /proc, or you manually remove /proc/fs/nfsd.
Comment 8 nobody 2018-05-01 23:44:40 UTC
Sorry for the noise and thanks for your support.