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
This commit is contained in:
parent
e9f4b69295
commit
c6e1a97eed
@ -171,7 +171,7 @@ g_vfs_open(struct vnode *vp, struct g_consumer **cpp, const char *fsname, int wr
|
||||
gp = g_new_geomf(&g_vfs_class, "%s.%s", fsname, pp->name);
|
||||
cp = g_new_consumer(gp);
|
||||
g_attach(cp, pp);
|
||||
error = g_access(cp, 1, wr, 1);
|
||||
error = g_access(cp, 1, wr, wr);
|
||||
if (error) {
|
||||
g_wither_geom(gp, ENXIO);
|
||||
return (error);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user