summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authormckusick <mckusick@FreeBSD.org>2011-07-10 00:41:31 +0000
committermckusick <mckusick@FreeBSD.org>2011-07-10 00:41:31 +0000
commitc6e1a97eed39ced79e67b27ad69214646ae6f5d0 (patch)
tree6e3e2f0e6c5e3e261d896deac8a5426eb4898fa8 /sys/ufs
parente9f4b69295e1fb2e2eefc78cf3b7855ee8314810 (diff)
downloadFreeBSD-src-c6e1a97eed39ced79e67b27ad69214646ae6f5d0.zip
FreeBSD-src-c6e1a97eed39ced79e67b27ad69214646ae6f5d0.tar.gz
Allow disk partitions associated with UFS read-only mounted
filesystems to be opened for writing. This functionality used to be special-cased for just the root filesystem, but with this change is now available for all UFS filesystems. This change is needed for journaled soft updates recovery. Discussed with: Jeff Roberson
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c22
1 files changed, 7 insertions, 15 deletions
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index b0f2d7e..553e954 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -273,7 +273,10 @@ ffs_mount(struct mount *mp)
softdep_unmount(mp);
DROP_GIANT();
g_topology_lock();
- g_access(ump->um_cp, 0, -1, 0);
+ /*
+ * Drop our write and exclusive access.
+ */
+ g_access(ump->um_cp, 0, -1, -1);
g_topology_unlock();
PICKUP_GIANT();
fs->fs_ronly = 1;
@@ -327,13 +330,9 @@ ffs_mount(struct mount *mp)
DROP_GIANT();
g_topology_lock();
/*
- * If we're the root device, we may not have an E count
- * yet, get it now.
+ * Request exclusive write access.
*/
- if (ump->um_cp->ace == 0)
- error = g_access(ump->um_cp, 0, 1, 1);
- else
- error = g_access(ump->um_cp, 0, 1, 0);
+ error = g_access(ump->um_cp, 0, 1, 1);
g_topology_unlock();
PICKUP_GIANT();
if (error)
@@ -665,13 +664,6 @@ ffs_mountfs(devvp, mp, td)
DROP_GIANT();
g_topology_lock();
error = g_vfs_open(devvp, &cp, "ffs", ronly ? 0 : 1);
-
- /*
- * If we are a root mount, drop the E flag so fsck can do its magic.
- * We will pick it up again when we remount R/W.
- */
- if (error == 0 && ronly && (mp->mnt_flag & MNT_ROOTFS))
- error = g_access(cp, 0, 0, -1);
g_topology_unlock();
PICKUP_GIANT();
VOP_UNLOCK(devvp, 0);
@@ -932,7 +924,7 @@ ffs_mountfs(devvp, mp, td)
strlcpy(fs->fs_fsmnt, mp->mnt_stat.f_mntonname, MAXMNTLEN);
mp->mnt_stat.f_iosize = fs->fs_bsize;
- if( mp->mnt_flag & MNT_ROOTFS) {
+ if (mp->mnt_flag & MNT_ROOTFS) {
/*
* Root mount; update timestamp in mount structure.
* this will be used by the common root mount code
OpenPOWER on IntegriCloud