From 3dbceccb787a2dcf41ae4f5e8b8a9a3f21419bb4 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Mon, 11 Mar 2002 13:53:00 +0000 Subject: [PATCH] As a XXX bandaid open the mounted device READ/WRITE even if we only mount read-only. The trouble here is that we don't reopen the device in read/write mode when we remount in read/write mode resulting in a filesystem sending write requests to a device which was only opened read/only. I'm not quite sure how such a reopen would best be done and defer the problem to more agile hackers. --- sys/ufs/ffs/ffs_vfsops.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c index 091fd647484..5c43f7ce703 100644 --- a/sys/ufs/ffs/ffs_vfsops.c +++ b/sys/ufs/ffs/ffs_vfsops.c @@ -591,7 +591,16 @@ ffs_mountfs(devvp, mp, td, malloctype) ronly = (mp->mnt_flag & MNT_RDONLY) != 0; vn_lock(devvp, LK_EXCLUSIVE | LK_RETRY, td); + /* + * XXX: We don't re-VOP_OPEN in FREAD|FWRITE mode if the filesystem + * XXX: is subsequently remounted, so open it FREAD|FWRITE from the + * XXX: start to avoid getting trashed later on. + */ +#ifdef notyet error = VOP_OPEN(devvp, ronly ? FREAD : FREAD|FWRITE, FSCRED, td); +#else + error = VOP_OPEN(devvp, FREAD|FWRITE, FSCRED, td); +#endif VOP_UNLOCK(devvp, 0, td); if (error) return (error); @@ -785,7 +794,12 @@ out: devvp->v_rdev->si_mountpoint = NULL; if (bp) brelse(bp); + /* XXX: see comment above VOP_OPEN */ +#ifdef notyet (void)VOP_CLOSE(devvp, ronly ? FREAD : FREAD|FWRITE, cred, td); +#else + (void)VOP_CLOSE(devvp, FREAD|FWRITE, cred, td); +#endif if (ump) { free(ump->um_fs, M_UFSMNT); free(ump, M_UFSMNT);