summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCraig Rodrigues <rodrigc@FreeBSD.org>2007-09-21 23:50:15 +0000
committerCraig Rodrigues <rodrigc@FreeBSD.org>2007-09-21 23:50:15 +0000
commit00cedf971bee3a4e522f34f6de0be1c5f928a42f (patch)
tree08a4c1cc07cce9883d248a668eb0dce4fcfab738
parent3011bef433264a83cdeb176e9d0c780d47067140 (diff)
Notes
-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 26ab396e6e38..9d1f485d0c77 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);