Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Jan 2016 16:41:26 +0000 (UTC)
From:      Alan Somers <asomers@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r294278 - stable/10/sbin/mount
Message-ID:  <201601181641.u0IGfQrc025155@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: asomers
Date: Mon Jan 18 16:41:26 2016
New Revision: 294278
URL: https://svnweb.freebsd.org/changeset/base/294278

Log:
  MFC r292573
  
  Fix "mount -a" for NFS and ZFS filesystems with shared mountpoints
  
  sbin/mount.c
  	Check whether an fstab entry has the same fstype as a mounted
  	filesystem before declaring it to be mounted. This will allow NFS
  	filesystems that share a mountpoint with a local filesystem to be
  	automatically mounted at boot.
  
  	This is not such an unusual situation. For example, if somebody uses
  	the standard installer with a ZFS root, he'll get a /usr/home
  	filesystem, even though he may choose to mount /usr/home over NFS.

Modified:
  stable/10/sbin/mount/mount.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sbin/mount/mount.c
==============================================================================
--- stable/10/sbin/mount/mount.c	Mon Jan 18 16:33:03 2016	(r294277)
+++ stable/10/sbin/mount/mount.c	Mon Jan 18 16:41:26 2016	(r294278)
@@ -485,10 +485,18 @@ ismounted(struct fstab *fs, struct statf
 		strlcpy(realfsfile, fs->fs_file, sizeof(realfsfile));
 	}
 
+	/* 
+	 * Consider the filesystem to be mounted if:
+	 * It has the same mountpoint as a mounted filesytem, and
+	 * It has the same type as that same mounted filesystem, and
+	 * It has the same device name as that same mounted filesystem, OR
+	 *     It is a nonremountable filesystem
+	 */
 	for (i = mntsize - 1; i >= 0; --i)
 		if (strcmp(realfsfile, mntbuf[i].f_mntonname) == 0 &&
+		    strcmp(fs->fs_vfstype, mntbuf[i].f_fstypename) == 0 && 
 		    (!isremountable(fs->fs_vfstype) ||
-		     strcmp(fs->fs_spec, mntbuf[i].f_mntfromname) == 0))
+		     (strcmp(fs->fs_spec, mntbuf[i].f_mntfromname) == 0)))
 			return (1);
 	return (0);
 }



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