Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/fs/union Change union_unmount() to not play with the fs ...



details:   https://anonhg.NetBSD.org/src/rev/2d56ee555ff3
branches:  trunk
changeset: 586948:2d56ee555ff3
user:      wrstuden <wrstuden%NetBSD.org@localhost>
date:      Thu Jan 05 20:31:33 2006 +0000

description:
Change union_unmount() to not play with the fs root vnode explicitly.
Let it get recycled along with all of the others. This is important
as if the root vnode has already been reclaimed, then we get a panic
when we try to vget it.

This addresses PR: kern/31382

diffstat:

 sys/fs/union/union_vfsops.c |  30 ++++--------------------------
 1 files changed, 4 insertions(+), 26 deletions(-)

diffs (80 lines):

diff -r d1fec709599f -r 2d56ee555ff3 sys/fs/union/union_vfsops.c
--- a/sys/fs/union/union_vfsops.c       Thu Jan 05 20:16:20 2006 +0000
+++ b/sys/fs/union/union_vfsops.c       Thu Jan 05 20:31:33 2006 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: union_vfsops.c,v 1.31 2005/12/11 12:24:29 christos Exp $       */
+/*     $NetBSD: union_vfsops.c,v 1.32 2006/01/05 20:31:33 wrstuden Exp $       */
 
 /*
  * Copyright (c) 1994 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.31 2005/12/11 12:24:29 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.32 2006/01/05 20:31:33 wrstuden Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -336,17 +336,12 @@
        struct lwp *l;
 {
        struct union_mount *um = MOUNTTOUNIONMOUNT(mp);
-       struct vnode *um_rootvp;
-       int error;
        int freeing;
 
 #ifdef UNION_DIAGNOSTIC
        printf("union_unmount(mp = %p)\n", mp);
 #endif
 
-       if ((error = union_root(mp, &um_rootvp)) != 0)
-               return (error);
-
        /*
         * Keep flushing vnodes from the mount list.
         * This is needed because of the un_pvp held
@@ -356,7 +351,7 @@
         * (d) times, where (d) is the maximum tree depth
         * in the filesystem.
         */
-       for (freeing = 0; vflush(mp, um_rootvp, 0) != 0;) {
+       for (freeing = 0; vflush(mp, NULL, 0) != 0;) {
                struct vnode *vp;
                int n;
 
@@ -379,18 +374,9 @@
         */
 
        if (mntflags & MNT_FORCE)
-               vflush(mp, um_rootvp, FORCECLOSE);
+               vflush(mp, NULL, FORCECLOSE);
 
 
-       /* At this point the root vnode should have a single reference */
-       if (um_rootvp->v_usecount > 1) {
-               vput(um_rootvp);
-               return (EBUSY);
-       }
-
-#ifdef UNION_DIAGNOSTIC
-       vprint("union root", um_rootvp);
-#endif
        /*
         * Discard references to upper and lower target vnodes.
         */
@@ -399,14 +385,6 @@
        vrele(um->um_uppervp);
        crfree(um->um_cred);
        /*
-        * Release reference on underlying root vnode
-        */
-       vput(um_rootvp);
-       /*
-        * And blow it away for future re-use
-        */
-       vgone(um_rootvp);
-       /*
         * Finally, throw away the union_mount structure
         */
        free(mp->mnt_data, M_UFSMNT);   /* XXX */



Home | Main Index | Thread Index | Old Index