summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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