check for forcible unmount at syscall level
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 11 May 1995 00:48:25 +0000 (16:48 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Thu, 11 May 1995 00:48:25 +0000 (16:48 -0800)
SCCS-vsn: sys/miscfs/fdesc/fdesc_vfsops.c 8.8
SCCS-vsn: sys/miscfs/kernfs/kernfs_vfsops.c 8.8
SCCS-vsn: sys/miscfs/nullfs/null_vfsops.c 8.5
SCCS-vsn: sys/miscfs/portal/portal_vfsops.c 8.9
SCCS-vsn: sys/miscfs/procfs/procfs_vfsops.c 8.7
SCCS-vsn: sys/miscfs/umapfs/umap_vfsops.c 8.6
SCCS-vsn: sys/miscfs/union/union_vfsops.c 8.17

usr/src/sys/miscfs/fdesc/fdesc_vfsops.c
usr/src/sys/miscfs/kernfs/kernfs_vfsops.c
usr/src/sys/miscfs/nullfs/null_vfsops.c
usr/src/sys/miscfs/portal/portal_vfsops.c
usr/src/sys/miscfs/procfs/procfs_vfsops.c
usr/src/sys/miscfs/umapfs/umap_vfsops.c
usr/src/sys/miscfs/union/union_vfsops.c

index 4c0a0d1..e2b20a7 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)fdesc_vfsops.c      8.7 (Berkeley) %G%
+ *     @(#)fdesc_vfsops.c      8.8 (Berkeley) %G%
  *
  * $Id: fdesc_vfsops.c,v 1.9 1993/04/06 15:28:33 jsp Exp $
  */
  *
  * $Id: fdesc_vfsops.c,v 1.9 1993/04/06 15:28:33 jsp Exp $
  */
@@ -89,15 +89,10 @@ fdesc_unmount(mp, mntflags, p)
 {
        int error;
        int flags = 0;
 {
        int error;
        int flags = 0;
-       extern int doforce;
        struct vnode *rootvp = VFSTOFDESC(mp)->f_root;
 
        struct vnode *rootvp = VFSTOFDESC(mp)->f_root;
 
-       if (mntflags & MNT_FORCE) {
-               /* fdesc can never be rootfs so don't check for it */
-               if (!doforce)
-                       return (EINVAL);
+       if (mntflags & MNT_FORCE)
                flags |= FORCECLOSE;
                flags |= FORCECLOSE;
-       }
 
        /*
         * Clear out buffer cache.  I don't think we
 
        /*
         * Clear out buffer cache.  I don't think we
index f207155..f441efa 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)kernfs_vfsops.c     8.7 (Berkeley) %G%
+ *     @(#)kernfs_vfsops.c     8.8 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -127,19 +127,14 @@ kernfs_unmount(mp, mntflags, p)
 {
        int error;
        int flags = 0;
 {
        int error;
        int flags = 0;
-       extern int doforce;
        struct vnode *rootvp = VFSTOKERNFS(mp)->kf_root;
 
 #ifdef KERNFS_DIAGNOSTIC
        printf("kernfs_unmount(mp = %x)\n", mp);
 #endif
 
        struct vnode *rootvp = VFSTOKERNFS(mp)->kf_root;
 
 #ifdef KERNFS_DIAGNOSTIC
        printf("kernfs_unmount(mp = %x)\n", mp);
 #endif
 
-       if (mntflags & MNT_FORCE) {
-               /* kernfs can never be rootfs so don't check for it */
-               if (!doforce)
-                       return (EINVAL);
+       if (mntflags & MNT_FORCE)
                flags |= FORCECLOSE;
                flags |= FORCECLOSE;
-       }
 
        /*
         * Clear out buffer cache.  I don't think we
 
        /*
         * Clear out buffer cache.  I don't think we
index 1c9dd5b..65174e5 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)null_vfsops.c       8.4 (Berkeley) %G%
+ *     @(#)null_vfsops.c       8.5 (Berkeley) %G%
  *
  * @(#)lofs_vfsops.c   1.2 (Berkeley) 6/18/92
  * $Id: lofs_vfsops.c,v 1.9 1992/05/30 10:26:24 jsp Exp jsp $
  *
  * @(#)lofs_vfsops.c   1.2 (Berkeley) 6/18/92
  * $Id: lofs_vfsops.c,v 1.9 1992/05/30 10:26:24 jsp Exp jsp $
@@ -157,18 +157,13 @@ nullfs_unmount(mp, mntflags, p)
        struct vnode *nullm_rootvp = MOUNTTONULLMOUNT(mp)->nullm_rootvp;
        int error;
        int flags = 0;
        struct vnode *nullm_rootvp = MOUNTTONULLMOUNT(mp)->nullm_rootvp;
        int error;
        int flags = 0;
-       extern int doforce;
 
 #ifdef NULLFS_DIAGNOSTIC
        printf("nullfs_unmount(mp = %x)\n", mp);
 #endif
 
 
 #ifdef NULLFS_DIAGNOSTIC
        printf("nullfs_unmount(mp = %x)\n", mp);
 #endif
 
-       if (mntflags & MNT_FORCE) {
-               /* lofs can never be rootfs so don't check for it */
-               if (!doforce)
-                       return (EINVAL);
+       if (mntflags & MNT_FORCE)
                flags |= FORCECLOSE;
                flags |= FORCECLOSE;
-       }
 
        /*
         * Clear out buffer cache.  I don't think we
 
        /*
         * Clear out buffer cache.  I don't think we
index 1f4c6b0..dc322f3 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)portal_vfsops.c     8.8 (Berkeley) %G%
+ *     @(#)portal_vfsops.c     8.9 (Berkeley) %G%
  *
  * $Id: portal_vfsops.c,v 1.5 1992/05/30 10:25:27 jsp Exp jsp $
  */
  *
  * $Id: portal_vfsops.c,v 1.5 1992/05/30 10:25:27 jsp Exp jsp $
  */
@@ -127,17 +127,12 @@ portal_unmount(mp, mntflags, p)
        int mntflags;
        struct proc *p;
 {
        int mntflags;
        struct proc *p;
 {
-       extern int doforce;
        struct vnode *rootvp = VFSTOPORTAL(mp)->pm_root;
        int error, flags = 0;
 
 
        struct vnode *rootvp = VFSTOPORTAL(mp)->pm_root;
        int error, flags = 0;
 
 
-       if (mntflags & MNT_FORCE) {
-               /* portal can never be rootfs so don't check for it */
-               if (!doforce)
-                       return (EINVAL);
+       if (mntflags & MNT_FORCE)
                flags |= FORCECLOSE;
                flags |= FORCECLOSE;
-       }
 
        /*
         * Clear out buffer cache.  I don't think we
 
        /*
         * Clear out buffer cache.  I don't think we
index 6fc0992..870a237 100644 (file)
@@ -8,7 +8,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)procfs_vfsops.c     8.6 (Berkeley) %G%
+ *     @(#)procfs_vfsops.c     8.7 (Berkeley) %G%
  *
  * From:
  *     $Id: procfs_vfsops.c,v 3.1 1993/12/15 09:40:17 jsp Exp $
  *
  * From:
  *     $Id: procfs_vfsops.c,v 3.1 1993/12/15 09:40:17 jsp Exp $
@@ -77,15 +77,10 @@ procfs_unmount(mp, mntflags, p)
        struct proc *p;
 {
        int error;
        struct proc *p;
 {
        int error;
-       extern int doforce;
        int flags = 0;
 
        int flags = 0;
 
-       if (mntflags & MNT_FORCE) {
-               /* procfs can never be rootfs so don't check for it */
-               if (!doforce)
-                       return (EINVAL);
+       if (mntflags & MNT_FORCE)
                flags |= FORCECLOSE;
                flags |= FORCECLOSE;
-       }
 
        if (error = vflush(mp, 0, flags))
                return (error);
 
        if (error = vflush(mp, 0, flags))
                return (error);
index 5f61b2d..b42e1d1 100644 (file)
@@ -7,7 +7,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)umap_vfsops.c       8.5 (Berkeley) %G%
+ *     @(#)umap_vfsops.c       8.6 (Berkeley) %G%
  *
  * @(#)null_vfsops.c       1.5 (Berkeley) 7/10/92
  */
  *
  * @(#)null_vfsops.c       1.5 (Berkeley) 7/10/92
  */
@@ -198,18 +198,13 @@ umapfs_unmount(mp, mntflags, p)
        struct vnode *umapm_rootvp = MOUNTTOUMAPMOUNT(mp)->umapm_rootvp;
        int error;
        int flags = 0;
        struct vnode *umapm_rootvp = MOUNTTOUMAPMOUNT(mp)->umapm_rootvp;
        int error;
        int flags = 0;
-       extern int doforce;
 
 #ifdef UMAPFS_DIAGNOSTIC
        printf("umapfs_unmount(mp = %x)\n", mp);
 #endif
 
 
 #ifdef UMAPFS_DIAGNOSTIC
        printf("umapfs_unmount(mp = %x)\n", mp);
 #endif
 
-       if (mntflags & MNT_FORCE) {
-               /* lofs can never be rootfs so don't check for it */
-               if (!doforce)
-                       return (EINVAL);
+       if (mntflags & MNT_FORCE)
                flags |= FORCECLOSE;
                flags |= FORCECLOSE;
-       }
 
        /*
         * Clear out buffer cache.  I don't think we
 
        /*
         * Clear out buffer cache.  I don't think we
index 53c326c..52b51e7 100644 (file)
@@ -8,7 +8,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)union_vfsops.c      8.16 (Berkeley) %G%
+ *     @(#)union_vfsops.c      8.17 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -243,18 +243,13 @@ union_unmount(mp, mntflags, p)
        int error;
        int freeing;
        int flags = 0;
        int error;
        int freeing;
        int flags = 0;
-       extern int doforce;
 
 #ifdef UNION_DIAGNOSTIC
        printf("union_unmount(mp = %x)\n", mp);
 #endif
 
 
 #ifdef UNION_DIAGNOSTIC
        printf("union_unmount(mp = %x)\n", mp);
 #endif
 
-       if (mntflags & MNT_FORCE) {
-               /* union can never be rootfs so don't check for it */
-               if (!doforce)
-                       return (EINVAL);
+       if (mntflags & MNT_FORCE)
                flags |= FORCECLOSE;
                flags |= FORCECLOSE;
-       }
 
        if (error = union_root(mp, &um_rootvp))
                return (error);
 
        if (error = union_root(mp, &um_rootvp))
                return (error);