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
(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?
It seems silly to safeguard against someone who removed the directory manually.
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
(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
It could be also done in nfs-utils.ebuild that would create the directory when someone install nfs-utils
/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?
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.
Sorry for the noise and thanks for your support.