From d85a9d1ba25ee5e21d630b594fa9811d7d33594d Mon Sep 17 00:00:00 2001 From: Kirk McKusick Date: Sat, 20 Apr 1991 00:08:21 -0800 Subject: [PATCH] add global flag to allow forcible unmounts to be attempted; when syncing, skip vnodes that are locked SCCS-vsn: sys/ufs/ffs/ffs_vfsops.c 7.54 SCCS-vsn: sys/ufs/ffs/ufs_vfsops.c 7.54 SCCS-vsn: sys/ufs/lfs/lfs_vfsops.c 7.54 SCCS-vsn: sys/ufs/ufs/ufs_vfsops.c 7.54 --- usr/src/sys/ufs/ffs/ffs_vfsops.c | 11 +++++++++-- usr/src/sys/ufs/ffs/ufs_vfsops.c | 11 +++++++++-- usr/src/sys/ufs/lfs/lfs_vfsops.c | 11 +++++++++-- usr/src/sys/ufs/ufs/ufs_vfsops.c | 11 +++++++++-- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/usr/src/sys/ufs/ffs/ffs_vfsops.c b/usr/src/sys/ufs/ffs/ffs_vfsops.c index a0e9ad500c..152bada809 100644 --- a/usr/src/sys/ufs/ffs/ffs_vfsops.c +++ b/usr/src/sys/ufs/ffs/ffs_vfsops.c @@ -4,7 +4,7 @@ * * %sccs.include.redist.c% * - * @(#)ffs_vfsops.c 7.53 (Berkeley) %G% + * @(#)ffs_vfsops.c 7.54 (Berkeley) %G% */ #include "param.h" @@ -43,6 +43,11 @@ struct vfsops ufs_vfsops = { ufs_init }; +/* + * Flag to allow forcible unmounting. + */ +int doforce = 1; + /* * Called by vfs_mountroot when ufs is going to be mounted as root. * @@ -330,7 +335,7 @@ ufs_unmount(mp, mntflags, p) int i, error, ronly, flags = 0; if (mntflags & MNT_FORCE) { - if (mp == rootfs) + if (!doforce || mp == rootfs) return (EINVAL); flags |= FORCECLOSE; } @@ -537,6 +542,8 @@ loop: */ if (vp->v_mount != mp) goto loop; + if (VOP_ISLOCKED(vp)) + continue; ip = VTOI(vp); if ((ip->i_flag & (IMOD|IACC|IUPD|ICHG)) == 0 && vp->v_dirtyblkhd == NULL) diff --git a/usr/src/sys/ufs/ffs/ufs_vfsops.c b/usr/src/sys/ufs/ffs/ufs_vfsops.c index 018849500a..15a62717bc 100644 --- a/usr/src/sys/ufs/ffs/ufs_vfsops.c +++ b/usr/src/sys/ufs/ffs/ufs_vfsops.c @@ -4,7 +4,7 @@ * * %sccs.include.redist.c% * - * @(#)ufs_vfsops.c 7.53 (Berkeley) %G% + * @(#)ufs_vfsops.c 7.54 (Berkeley) %G% */ #include "param.h" @@ -43,6 +43,11 @@ struct vfsops ufs_vfsops = { ufs_init }; +/* + * Flag to allow forcible unmounting. + */ +int doforce = 1; + /* * Called by vfs_mountroot when ufs is going to be mounted as root. * @@ -330,7 +335,7 @@ ufs_unmount(mp, mntflags, p) int i, error, ronly, flags = 0; if (mntflags & MNT_FORCE) { - if (mp == rootfs) + if (!doforce || mp == rootfs) return (EINVAL); flags |= FORCECLOSE; } @@ -537,6 +542,8 @@ loop: */ if (vp->v_mount != mp) goto loop; + if (VOP_ISLOCKED(vp)) + continue; ip = VTOI(vp); if ((ip->i_flag & (IMOD|IACC|IUPD|ICHG)) == 0 && vp->v_dirtyblkhd == NULL) diff --git a/usr/src/sys/ufs/lfs/lfs_vfsops.c b/usr/src/sys/ufs/lfs/lfs_vfsops.c index 02ad69b25a..d4683e98b3 100644 --- a/usr/src/sys/ufs/lfs/lfs_vfsops.c +++ b/usr/src/sys/ufs/lfs/lfs_vfsops.c @@ -4,7 +4,7 @@ * * %sccs.include.redist.c% * - * @(#)lfs_vfsops.c 7.53 (Berkeley) %G% + * @(#)lfs_vfsops.c 7.54 (Berkeley) %G% */ #include "param.h" @@ -43,6 +43,11 @@ struct vfsops ufs_vfsops = { ufs_init }; +/* + * Flag to allow forcible unmounting. + */ +int doforce = 1; + /* * Called by vfs_mountroot when ufs is going to be mounted as root. * @@ -330,7 +335,7 @@ ufs_unmount(mp, mntflags, p) int i, error, ronly, flags = 0; if (mntflags & MNT_FORCE) { - if (mp == rootfs) + if (!doforce || mp == rootfs) return (EINVAL); flags |= FORCECLOSE; } @@ -537,6 +542,8 @@ loop: */ if (vp->v_mount != mp) goto loop; + if (VOP_ISLOCKED(vp)) + continue; ip = VTOI(vp); if ((ip->i_flag & (IMOD|IACC|IUPD|ICHG)) == 0 && vp->v_dirtyblkhd == NULL) diff --git a/usr/src/sys/ufs/ufs/ufs_vfsops.c b/usr/src/sys/ufs/ufs/ufs_vfsops.c index 018849500a..15a62717bc 100644 --- a/usr/src/sys/ufs/ufs/ufs_vfsops.c +++ b/usr/src/sys/ufs/ufs/ufs_vfsops.c @@ -4,7 +4,7 @@ * * %sccs.include.redist.c% * - * @(#)ufs_vfsops.c 7.53 (Berkeley) %G% + * @(#)ufs_vfsops.c 7.54 (Berkeley) %G% */ #include "param.h" @@ -43,6 +43,11 @@ struct vfsops ufs_vfsops = { ufs_init }; +/* + * Flag to allow forcible unmounting. + */ +int doforce = 1; + /* * Called by vfs_mountroot when ufs is going to be mounted as root. * @@ -330,7 +335,7 @@ ufs_unmount(mp, mntflags, p) int i, error, ronly, flags = 0; if (mntflags & MNT_FORCE) { - if (mp == rootfs) + if (!doforce || mp == rootfs) return (EINVAL); flags |= FORCECLOSE; } @@ -537,6 +542,8 @@ loop: */ if (vp->v_mount != mp) goto loop; + if (VOP_ISLOCKED(vp)) + continue; ip = VTOI(vp); if ((ip->i_flag & (IMOD|IACC|IUPD|ICHG)) == 0 && vp->v_dirtyblkhd == NULL) -- 2.20.1