Source-Changes-HG archive

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

[src/trunk]: src/sys Add new VFS op routine - vfs_done and call it on filesys...



details:   https://anonhg.NetBSD.org/src/rev/23089fd323fa
branches:  trunk
changeset: 483726:23089fd323fa
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Thu Mar 16 18:08:17 2000 +0000

description:
Add new VFS op routine - vfs_done and call it on filesystem detach
in vfs_detach(). vfs_done may free global filesystem's resources,
typically those allocated in respective filesystem's init function.
Needed so those filesystems which went in via LKM have a chance to
clean after themselves before unloading. This fixes random panics
when LKM for filesystem using pools was loaded and unloaded several
times.

For each leaf filesystem, add appropriate vfs_done routine.

diffstat:

 sys/adosfs/advfsops.c               |  10 +++++++++-
 sys/coda/coda_vfsops.c              |  13 ++++++++++++-
 sys/coda/coda_vfsops.h              |   3 ++-
 sys/filecorefs/filecore_extern.h    |   3 ++-
 sys/filecorefs/filecore_node.c      |  13 +++++++++++--
 sys/filecorefs/filecore_vfsops.c    |   3 ++-
 sys/isofs/cd9660/cd9660_extern.h    |   3 ++-
 sys/isofs/cd9660/cd9660_node.c      |  16 ++++++++++++++--
 sys/isofs/cd9660/cd9660_vfsops.c    |   3 ++-
 sys/kern/vfs_subr.c                 |   7 ++++++-
 sys/miscfs/fdesc/fdesc.h            |   3 ++-
 sys/miscfs/fdesc/fdesc_vfsops.c     |   3 ++-
 sys/miscfs/fdesc/fdesc_vnops.c      |  11 ++++++++++-
 sys/miscfs/genfs/layer_extern.h     |   3 ++-
 sys/miscfs/genfs/layer_subr.c       |  14 ++++++++++++--
 sys/miscfs/kernfs/kernfs_vfsops.c   |   9 ++++++++-
 sys/miscfs/overlay/overlay_vfsops.c |   3 ++-
 sys/miscfs/portal/portal_vfsops.c   |   9 ++++++++-
 sys/miscfs/procfs/procfs.h          |   3 ++-
 sys/miscfs/procfs/procfs_subr.c     |  11 ++++++++++-
 sys/miscfs/procfs/procfs_vfsops.c   |  10 +++++++++-
 sys/miscfs/union/union.h            |   3 ++-
 sys/miscfs/union/union_subr.c       |  11 ++++++++++-
 sys/miscfs/union/union_vfsops.c     |   3 ++-
 sys/msdosfs/msdosfs_denode.c        |   9 ++++++++-
 sys/msdosfs/msdosfs_vfsops.c        |   3 ++-
 sys/msdosfs/msdosfsmount.h          |   3 ++-
 sys/nfs/nfs_node.c                  |  13 ++++++++++++-
 sys/nfs/nfs_subs.c                  |   8 +++++++-
 sys/nfs/nfs_var.h                   |   3 ++-
 sys/nfs/nfs_vfsops.c                |   3 ++-
 sys/nfs/nfsmount.h                  |   3 ++-
 sys/ntfs/ntfs_ihash.c               |  14 +++++++++++++-
 sys/ntfs/ntfs_ihash.h               |   3 ++-
 sys/ntfs/ntfs_vfsops.c              |  27 ++++++++++-----------------
 sys/sys/mount.h                     |   5 +++--
 sys/ufs/ext2fs/ext2fs_extern.h      |   5 +++--
 sys/ufs/ext2fs/ext2fs_vfsops.c      |   9 ++++++++-
 sys/ufs/lfs/lfs_extern.h            |   5 +++--
 sys/ufs/lfs/lfs_vfsops.c            |  10 +++++++++-
 40 files changed, 231 insertions(+), 62 deletions(-)

diffs (truncated from 994 to 300 lines):

diff -r 39284b889bf7 -r 23089fd323fa sys/adosfs/advfsops.c
--- a/sys/adosfs/advfsops.c     Thu Mar 16 17:33:04 2000 +0000
+++ b/sys/adosfs/advfsops.c     Thu Mar 16 18:08:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: advfsops.c,v 1.41 1999/11/15 20:55:48 tron Exp $       */
+/*     $NetBSD: advfsops.c,v 1.42 2000/03/16 18:08:21 jdolecek Exp $   */
 
 /*
  * Copyright (c) 1994 Christian E. Hopps
@@ -53,6 +53,7 @@
 #include <adosfs/adosfs.h>
 
 void adosfs_init __P((void));
+void adosfs_done __P((void));
 int adosfs_mount __P((struct mount *, const char *, void *, struct nameidata *,
                      struct proc *));
 int adosfs_start __P((struct mount *, int, struct proc *));
@@ -794,6 +795,12 @@
            M_ANODE);
 }
 
+void
+adosfs_done()
+{
+       pool_destroy(&adosfs_node_pool);
+}
+
 int
 adosfs_sysctl(name, namelen, oldp, oldlenp, newp, newlen, p)
        int *name;
@@ -831,6 +838,7 @@
        adosfs_fhtovp,                  
        adosfs_vptofh,                  
        adosfs_init,                    
+       adosfs_done,
        adosfs_sysctl,
        NULL,                           /* vfs_mountroot */
        adosfs_checkexp,
diff -r 39284b889bf7 -r 23089fd323fa sys/coda/coda_vfsops.c
--- a/sys/coda/coda_vfsops.c    Thu Mar 16 17:33:04 2000 +0000
+++ b/sys/coda/coda_vfsops.c    Thu Mar 16 18:08:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: coda_vfsops.c,v 1.8 1999/10/17 23:39:16 cgd Exp $      */
+/*     $NetBSD: coda_vfsops.c,v 1.9 2000/03/16 18:08:21 jdolecek Exp $ */
 
 /*
  * 
@@ -109,6 +109,9 @@
        eopnotsupp,
     (int (*) (struct vnode *, struct fid *)) eopnotsupp,
     coda_init,
+#ifdef __NetBSD__
+    coda_done,
+#endif
     coda_sysctl,
     (int (*)(void)) eopnotsupp,
     (int (*)(struct mount *, struct mbuf *, int *, struct ucred **))
@@ -535,6 +538,14 @@
     ENTRY;
 }
 
+#ifdef __NetBSD__
+void
+coda_done(void)
+{
+    ENTRY;
+}
+#endif
+
 int
 coda_sysctl(name, namelen, oldp, oldlp, newp, newl, p)
        int *name;
diff -r 39284b889bf7 -r 23089fd323fa sys/coda/coda_vfsops.h
--- a/sys/coda/coda_vfsops.h    Thu Mar 16 17:33:04 2000 +0000
+++ b/sys/coda/coda_vfsops.h    Thu Mar 16 18:08:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: coda_vfsops.h,v 1.4 1998/09/15 02:03:00 rvb Exp $      */
+/*     $NetBSD: coda_vfsops.h,v 1.5 2000/03/16 18:08:21 jdolecek Exp $ */
 
 /*
  * 
@@ -59,6 +59,7 @@
                       int *, struct ucred **);
 int coda_vptofh(struct vnode *, struct fid *);
 void coda_init(void);
+void coda_done(void);
 int coda_sysctl(int *, u_int, void *, size_t *, void *, size_t,
                    struct proc *);
 int getNewVnode(struct vnode **vpp);
diff -r 39284b889bf7 -r 23089fd323fa sys/filecorefs/filecore_extern.h
--- a/sys/filecorefs/filecore_extern.h  Thu Mar 16 17:33:04 2000 +0000
+++ b/sys/filecorefs/filecore_extern.h  Thu Mar 16 18:08:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecore_extern.h,v 1.5 1999/02/26 23:44:44 wrstuden Exp $     */
+/*     $NetBSD: filecore_extern.h,v 1.6 2000/03/16 18:08:22 jdolecek Exp $     */
 
 /*-
  * Copyright (c) 1998 Andrew McMurry
@@ -86,6 +86,7 @@
            struct ucred **));
 int filecore_vptofh __P((struct vnode *, struct fid *));
 void filecore_init __P((void));
+void filecore_done __P((void));
 int filecore_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
                        struct proc *));
 
diff -r 39284b889bf7 -r 23089fd323fa sys/filecorefs/filecore_node.c
--- a/sys/filecorefs/filecore_node.c    Thu Mar 16 17:33:04 2000 +0000
+++ b/sys/filecorefs/filecore_node.c    Thu Mar 16 18:08:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecore_node.c,v 1.4 1999/07/08 01:06:00 wrstuden Exp $       */
+/*     $NetBSD: filecore_node.c,v 1.5 2000/03/16 18:08:22 jdolecek Exp $       */
 
 /*-
  * Copyright (c) 1998 Andrew McMurry
@@ -73,7 +73,6 @@
 void
 filecore_init()
 {
-
        filecorehashtbl = hashinit(desiredvnodes, M_FILECOREMNT, M_WAITOK,
            &filecorehash);
        simple_lock_init(&filecore_ihash_slock);
@@ -83,6 +82,16 @@
 }
 
 /*
+ * Destroy node pool and hash table.
+ */
+void
+filecore_done()
+{
+       pool_destroy(&filecore_node_pool);
+       hashdone(filecorehashtbl, M_FILECOREMNT);
+}
+
+/*
  * Use the device/inum pair to find the incore inode, and return a pointer
  * to it. If it is in core, but locked, wait for it.
  */
diff -r 39284b889bf7 -r 23089fd323fa sys/filecorefs/filecore_vfsops.c
--- a/sys/filecorefs/filecore_vfsops.c  Thu Mar 16 17:33:04 2000 +0000
+++ b/sys/filecorefs/filecore_vfsops.c  Thu Mar 16 18:08:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: filecore_vfsops.c,v 1.10 1999/11/15 18:49:08 fvdl Exp $        */
+/*     $NetBSD: filecore_vfsops.c,v 1.11 2000/03/16 18:08:22 jdolecek Exp $    */
 
 /*-
  * Copyright (c) 1998 Andrew McMurry
@@ -79,6 +79,7 @@
        filecore_fhtovp,
        filecore_vptofh,
        filecore_init,
+       filecore_done,
        filecore_sysctl,
        NULL,                           /* filecore_mountroot */
        filecore_checkexp,
diff -r 39284b889bf7 -r 23089fd323fa sys/isofs/cd9660/cd9660_extern.h
--- a/sys/isofs/cd9660/cd9660_extern.h  Thu Mar 16 17:33:04 2000 +0000
+++ b/sys/isofs/cd9660/cd9660_extern.h  Thu Mar 16 18:08:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660_extern.h,v 1.7 1999/07/13 11:12:05 scw Exp $    */
+/*     $NetBSD: cd9660_extern.h,v 1.8 2000/03/16 18:08:23 jdolecek Exp $       */
 
 /*-
  * Copyright (c) 1994
@@ -98,6 +98,7 @@
            struct ucred **));
 int cd9660_vptofh __P((struct vnode *, struct fid *));
 void cd9660_init __P((void));
+void cd9660_done __P((void));
 int cd9660_sysctl __P((int *, u_int, void *, size_t *, void *, size_t,
                        struct proc *));
 
diff -r 39284b889bf7 -r 23089fd323fa sys/isofs/cd9660/cd9660_node.c
--- a/sys/isofs/cd9660/cd9660_node.c    Thu Mar 16 17:33:04 2000 +0000
+++ b/sys/isofs/cd9660/cd9660_node.c    Thu Mar 16 18:08:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660_node.c,v 1.21 1999/07/08 01:06:00 wrstuden Exp $        */
+/*     $NetBSD: cd9660_node.c,v 1.22 2000/03/16 18:08:23 jdolecek Exp $        */
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1994
@@ -85,7 +85,6 @@
 void
 cd9660_init()
 {
-
        isohashtbl = hashinit(desiredvnodes, M_ISOFSMNT, M_WAITOK, &isohash);
        simple_lock_init(&cd9660_ihash_slock);
 #ifdef ISODEVMAP
@@ -97,6 +96,19 @@
            M_ISOFSNODE);
 }
 
+/*
+ * Destroy node pool and hash table.
+ */
+void
+cd9660_done()
+{
+       hashdone(isohashtbl, M_ISOFSMNT);
+#ifdef ISODEVMAP
+       hashdone(idvhashtbl, M_ISOFSMNT);
+#endif
+       pool_destroy(&cd9660_node_pool);
+}
+
 #ifdef ISODEVMAP
 /*
  * Enter a new node into the device hash list
diff -r 39284b889bf7 -r 23089fd323fa sys/isofs/cd9660/cd9660_vfsops.c
--- a/sys/isofs/cd9660/cd9660_vfsops.c  Thu Mar 16 17:33:04 2000 +0000
+++ b/sys/isofs/cd9660/cd9660_vfsops.c  Thu Mar 16 18:08:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cd9660_vfsops.c,v 1.43 2000/01/11 09:04:50 scw Exp $   */
+/*     $NetBSD: cd9660_vfsops.c,v 1.44 2000/03/16 18:08:23 jdolecek Exp $      */
 
 /*-
  * Copyright (c) 1994
@@ -93,6 +93,7 @@
        cd9660_fhtovp,
        cd9660_vptofh,
        cd9660_init,
+       cd9660_done,
        cd9660_sysctl,
        cd9660_mountroot,
        cd9660_check_export,
diff -r 39284b889bf7 -r 23089fd323fa sys/kern/vfs_subr.c
--- a/sys/kern/vfs_subr.c       Thu Mar 16 17:33:04 2000 +0000
+++ b/sys/kern/vfs_subr.c       Thu Mar 16 18:08:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vfs_subr.c,v 1.120 2000/03/15 16:28:45 fvdl Exp $      */
+/*     $NetBSD: vfs_subr.c,v 1.121 2000/03/16 18:08:20 jdolecek Exp $  */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -2506,6 +2506,11 @@
                return (ESRCH);
 
        /*
+        * Now run the file system-specific cleanups.
+        */
+       (*vfs->vfs_done)();
+
+       /*
         * Free the vnode operations vector.
         */
        vfs_opv_free(vfs->vfs_opv_descs);
diff -r 39284b889bf7 -r 23089fd323fa sys/miscfs/fdesc/fdesc.h
--- a/sys/miscfs/fdesc/fdesc.h  Thu Mar 16 17:33:04 2000 +0000
+++ b/sys/miscfs/fdesc/fdesc.h  Thu Mar 16 18:08:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdesc.h,v 1.10 1998/03/01 02:21:08 fvdl Exp $  */
+/*     $NetBSD: fdesc.h,v 1.11 2000/03/16 18:08:23 jdolecek Exp $      */
 
 /*
  * Copyright (c) 1992, 1993
@@ -76,6 +76,7 @@
 
 extern dev_t devctty;
 extern void fdesc_init __P((void));
+extern void fdesc_done __P((void));
 extern int fdesc_root __P((struct mount *, struct vnode **));
 extern int fdesc_allocvp __P((fdntype, int, struct mount *, struct vnode **));
 extern int (**fdesc_vnodeop_p) __P((void *));
diff -r 39284b889bf7 -r 23089fd323fa sys/miscfs/fdesc/fdesc_vfsops.c
--- a/sys/miscfs/fdesc/fdesc_vfsops.c   Thu Mar 16 17:33:04 2000 +0000
+++ b/sys/miscfs/fdesc/fdesc_vfsops.c   Thu Mar 16 18:08:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdesc_vfsops.c,v 1.28 1999/07/08 01:26:26 wrstuden Exp $       */
+/*     $NetBSD: fdesc_vfsops.c,v 1.29 2000/03/16 18:08:23 jdolecek Exp $       */
 
 /*
  * Copyright (c) 1992, 1993, 1995
@@ -345,6 +345,7 @@
        fdesc_fhtovp,
        fdesc_vptofh,
        fdesc_init,
+       fdesc_done,
        fdesc_sysctl,
        NULL,                           /* vfs_mountroot */
        fdesc_checkexp,
diff -r 39284b889bf7 -r 23089fd323fa sys/miscfs/fdesc/fdesc_vnops.c
--- a/sys/miscfs/fdesc/fdesc_vnops.c    Thu Mar 16 17:33:04 2000 +0000
+++ b/sys/miscfs/fdesc/fdesc_vnops.c    Thu Mar 16 18:08:17 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fdesc_vnops.c,v 1.53 1999/08/25 14:42:35 sommerfeld Exp $      */
+/*     $NetBSD: fdesc_vnops.c,v 1.54 2000/03/16 18:08:24 jdolecek Exp $        */
 
 /*
  * Copyright (c) 1992, 1993
@@ -199,6 +199,15 @@
 }
 
 /*
+ * Free hash table.
+ */
+void
+fdesc_done()



Home | Main Index | Thread Index | Old Index