summaryrefslogtreecommitdiffstats
path: root/sbin/mount
diff options
context:
space:
mode:
authorasomers <asomers@FreeBSD.org>2016-01-18 16:41:26 +0000
committerasomers <asomers@FreeBSD.org>2016-01-18 16:41:26 +0000
commit628004b7857599544a8b1f99cb2114e13254a693 (patch)
tree53da7215b59e7f6dcc704739dfeca4827f250fac /sbin/mount
parent6a718e822773d7edbb4c6eb0321cad72d372e20e (diff)
downloadFreeBSD-src-628004b7857599544a8b1f99cb2114e13254a693.zip
FreeBSD-src-628004b7857599544a8b1f99cb2114e13254a693.tar.gz
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.
Diffstat (limited to 'sbin/mount')
-rw-r--r--sbin/mount/mount.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/sbin/mount/mount.c b/sbin/mount/mount.c
index 5ea45df..1d35f3e 100644
--- a/sbin/mount/mount.c
+++ b/sbin/mount/mount.c
@@ -485,10 +485,18 @@ ismounted(struct fstab *fs, struct statfs *mntbuf, int mntsize)
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);
}
OpenPOWER on IntegriCloud