summaryrefslogtreecommitdiffstats
path: root/sys/gnu
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2004-01-24 08:43:06 +0000
committertjr <tjr@FreeBSD.org>2004-01-24 08:43:06 +0000
commit7c0b7f1f33989974bd139577a87ae029a6f46aa9 (patch)
tree2e7dcae3ca69ad104151ade1f44ca771439d2ff7 /sys/gnu
parent76b78c430bd5b96e734f0c3f355f3d26b26989cb (diff)
downloadFreeBSD-src-7c0b7f1f33989974bd139577a87ae029a6f46aa9.zip
FreeBSD-src-7c0b7f1f33989974bd139577a87ae029a6f46aa9.tar.gz
Copy workaround from FFS: open device for write access even if
the user requests a read-only mount. This is necessary because we don't do the VOP_OPEN again if they upgrade a read-only mount to read-write. Noticed by: bde
Diffstat (limited to 'sys/gnu')
-rw-r--r--sys/gnu/ext2fs/ext2_vfsops.c19
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c19
2 files changed, 38 insertions, 0 deletions
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c
index 1fa812c..b3b327d 100644
--- a/sys/gnu/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/ext2fs/ext2_vfsops.c
@@ -655,7 +655,16 @@ ext2_mountfs(devvp, mp, td)
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
+ /*
+ * XXX Open the device with write access even if the filesystem
+ * is read-only: someone may remount it read-write later, and
+ * we don't VOP_OPEN the device again in that case.
+ */
+#ifdef notyet
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td, -1);
+#else
+ error = VOP_OPEN(devvp, FREAD|FWRITE, FSCRED, td, -1);
+#endif
VOP_UNLOCK(devvp, 0, td);
if (error)
return (error);
@@ -735,7 +744,12 @@ ext2_mountfs(devvp, mp, td)
out:
if (bp)
brelse(bp);
+ /* XXX See comment at VOP_OPEN call */
+#ifdef notyet
(void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, td);
+#else
+ (void)VOP_CLOSE(devvp, FREAD|FWRITE, NOCRED, td);
+#endif
if (ump) {
bsd_free(ump->um_e2fs->s_es, M_EXT2MNT);
bsd_free(ump->um_e2fs, M_EXT2MNT);
@@ -790,8 +804,13 @@ ext2_unmount(mp, mntflags, td)
ULCK_BUF(fs->s_block_bitmap[i])
ump->um_devvp->v_rdev->si_mountpoint = NULL;
+ /* XXX See comment at VOP_OPEN call */
+#ifdef notyet
error = VOP_CLOSE(ump->um_devvp, ronly ? FREAD : FREAD|FWRITE,
NOCRED, td);
+#else
+ error = VOP_CLOSE(ump->um_devvp, FREAD|FWRITE, NOCRED, td);
+#endif
vrele(ump->um_devvp);
bsd_free(fs->s_es, M_EXT2MNT);
bsd_free(fs, M_EXT2MNT);
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index 1fa812c..b3b327d 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c
@@ -655,7 +655,16 @@ ext2_mountfs(devvp, mp, td)
ronly = (mp->mnt_flag & MNT_RDONLY) != 0;
vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td);
+ /*
+ * XXX Open the device with write access even if the filesystem
+ * is read-only: someone may remount it read-write later, and
+ * we don't VOP_OPEN the device again in that case.
+ */
+#ifdef notyet
error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td, -1);
+#else
+ error = VOP_OPEN(devvp, FREAD|FWRITE, FSCRED, td, -1);
+#endif
VOP_UNLOCK(devvp, 0, td);
if (error)
return (error);
@@ -735,7 +744,12 @@ ext2_mountfs(devvp, mp, td)
out:
if (bp)
brelse(bp);
+ /* XXX See comment at VOP_OPEN call */
+#ifdef notyet
(void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, NOCRED, td);
+#else
+ (void)VOP_CLOSE(devvp, FREAD|FWRITE, NOCRED, td);
+#endif
if (ump) {
bsd_free(ump->um_e2fs->s_es, M_EXT2MNT);
bsd_free(ump->um_e2fs, M_EXT2MNT);
@@ -790,8 +804,13 @@ ext2_unmount(mp, mntflags, td)
ULCK_BUF(fs->s_block_bitmap[i])
ump->um_devvp->v_rdev->si_mountpoint = NULL;
+ /* XXX See comment at VOP_OPEN call */
+#ifdef notyet
error = VOP_CLOSE(ump->um_devvp, ronly ? FREAD : FREAD|FWRITE,
NOCRED, td);
+#else
+ error = VOP_CLOSE(ump->um_devvp, FREAD|FWRITE, NOCRED, td);
+#endif
vrele(ump->um_devvp);
bsd_free(fs->s_es, M_EXT2MNT);
bsd_free(fs, M_EXT2MNT);
OpenPOWER on IntegriCloud