Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Aug 2020 12:14:20 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r364985 - stable/12/libexec/rc/rc.d
Message-ID:  <202008311214.07VCEKao091305@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Mon Aug 31 12:14:20 2020
New Revision: 364985
URL: https://svnweb.freebsd.org/changeset/base/364985

Log:
  In 13-CURRENT, the linux rc script uses "nocover" mount option to avoid
  mounting required filesystems twice.  However, this option hasn't been MFC'd.
  Implement its functionality in a different way, by stating the mount point.
  
  Submitted by:	sigsys@gmail.com
  Differential Revision:	https://reviews.freebsd.org/D26217

Modified:
  stable/12/libexec/rc/rc.d/linux

Modified: stable/12/libexec/rc/rc.d/linux
==============================================================================
--- stable/12/libexec/rc/rc.d/linux	Mon Aug 31 09:05:45 2020	(r364984)
+++ stable/12/libexec/rc/rc.d/linux	Mon Aug 31 12:14:20 2020	(r364985)
@@ -15,6 +15,12 @@ rcvar="linux_enable"
 start_cmd="${name}_start"
 stop_cmd=":"
 
+unmounted()
+{
+	[ `stat -f "%d" "$1"` == `stat -f "%d" "$1/.."` -a \
+	  `stat -f "%i" "$1"` != `stat -f "%i" "$1/.."` ]
+}
+
 linux_start()
 {
 	local _emul_path _tmpdir
@@ -48,11 +54,12 @@ linux_start()
 
 	if checkyesno linux_mounts_enable; then 
 		_emul_path="/compat/linux"
-		mount -t linprocfs linprocfs "${_emul_path}/proc"
-		mount -t linsysfs linsysfs "${_emul_path}/sys"
-		mount -t devfs devfs "${_emul_path}/dev"
-		mount -o linrdlnk -t fdescfs fdescfs "${_emul_path}/dev/fd"
-		mount -o mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm"
+		unmounted "${_emul_path}/proc" && mount -t linprocfs linprocfs "${_emul_path}/proc"
+		unmounted "${_emul_path}/sys" && mount -t linsysfs linsysfs "${_emul_path}/sys"
+		unmounted "${_emul_path}/dev" && mount -t devfs devfs "${_emul_path}/dev"
+		unmounted "${_emul_path}/dev/fd" && mount -o linrdlnk -t fdescfs fdescfs "${_emul_path}/dev/fd"
+		unmounted "${_emul_path}/dev/shm" && mount -o mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm"
+		true
 	fi
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008311214.07VCEKao091305>