summaryrefslogtreecommitdiffstats
path: root/sys/fs/ntfs
diff options
context:
space:
mode:
authorrodrigc <rodrigc@FreeBSD.org>2007-09-21 23:50:15 +0000
committerrodrigc <rodrigc@FreeBSD.org>2007-09-21 23:50:15 +0000
commitb2b7d089f7b65fca40aa6d1e09199f2c4439750c (patch)
tree08a4c1cc07cce9883d248a668eb0dce4fcfab738 /sys/fs/ntfs
parent4ec928319a2aa28a8f011f588e4e3c7dba43a6d4 (diff)
downloadFreeBSD-src-b2b7d089f7b65fca40aa6d1e09199f2c4439750c.zip
FreeBSD-src-b2b7d089f7b65fca40aa6d1e09199f2c4439750c.tar.gz
Disable multiple ntfs mounts to the same mountpoint.
Eliminates panics due to locking issues. Idea taken from src/sys/gnu/fs/xfs/FreeBSD/xfs_super.c. PR: 89966, 92000, 104393 Reported by: H. Matsuo <hiroshi50000 yahoo co jp>, Chris <m2chrischou gmail.com>, Andrey V. Elsukov <bu7cher yandex ru>, Jan Henrik Sylvester <me janh de> Approved by: re (kensmith)
Diffstat (limited to 'sys/fs/ntfs')
-rw-r--r--sys/fs/ntfs/ntfs_vfsops.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c
index 26ab396..9d1f485 100644
--- a/sys/fs/ntfs/ntfs_vfsops.c
+++ b/sys/fs/ntfs/ntfs_vfsops.c
@@ -261,12 +261,26 @@ ntfs_mountfs(devvp, mp, td)
int error, ronly, i, v;
struct vnode *vp;
struct g_consumer *cp;
+ struct g_provider *pp;
char *cs_ntfs, *cs_local;
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
DROP_GIANT();
g_topology_lock();
- error = g_vfs_open(devvp, &cp, "ntfs", ronly ? 0 : 1);
+
+ /*
+ * XXX: Do not allow more than one consumer to open a device
+ * associated with a particular GEOM provider.
+ * This disables multiple read-only mounts of a device,
+ * but it gets rid of panics in vget() when you try to
+ * mount the same device more than once.
+ */
+ pp = g_dev_getprovider(devvp->v_rdev);
+ if ((pp != NULL) && ((pp->acr | pp->acw | pp->ace ) != 0))
+ error = EPERM;
+ else
+ error = g_vfs_open(devvp, &cp, "ntfs", ronly ? 0 : 1);
+
g_topology_unlock();
PICKUP_GIANT();
VOP_UNLOCK(devvp, 0, td);
OpenPOWER on IntegriCloud