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: sig...@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
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to