diff options
Diffstat (limited to 'sys/fs')
-rw-r--r-- | sys/fs/cd9660/cd9660_node.c | 7 | ||||
-rw-r--r-- | sys/fs/coda/coda_vnops.c | 1 | ||||
-rw-r--r-- | sys/fs/deadfs/dead_vnops.c | 4 | ||||
-rw-r--r-- | sys/fs/devfs/devfs_vfsops.c | 2 | ||||
-rw-r--r-- | sys/fs/hpfs/hpfs.h | 1 | ||||
-rw-r--r-- | sys/fs/hpfs/hpfs_hash.c | 14 | ||||
-rw-r--r-- | sys/fs/hpfs/hpfs_vfsops.c | 13 | ||||
-rw-r--r-- | sys/fs/hpfs/hpfs_vnops.c | 2 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_denode.c | 7 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_vfsops.c | 6 | ||||
-rw-r--r-- | sys/fs/msdosfs/msdosfs_vnops.c | 6 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_ihash.c | 9 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_ihash.h | 1 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_inode.h | 2 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_subr.c | 28 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_subr.h | 1 | ||||
-rw-r--r-- | sys/fs/ntfs/ntfs_vfsops.c | 15 | ||||
-rw-r--r-- | sys/fs/nullfs/null_subr.c | 4 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_node.c | 1 | ||||
-rw-r--r-- | sys/fs/nwfs/nwfs_vnops.c | 16 | ||||
-rw-r--r-- | sys/fs/unionfs/union_subr.c | 1 |
21 files changed, 111 insertions, 30 deletions
diff --git a/sys/fs/cd9660/cd9660_node.c b/sys/fs/cd9660/cd9660_node.c index 54bace3..500a1a6 100644 --- a/sys/fs/cd9660/cd9660_node.c +++ b/sys/fs/cd9660/cd9660_node.c @@ -49,6 +49,8 @@ #include <sys/malloc.h> #include <sys/stat.h> +#include <machine/mutex.h> + #include <isofs/cd9660/iso.h> #include <isofs/cd9660/cd9660_node.h> #include <isofs/cd9660/cd9660_mount.h> @@ -108,7 +110,7 @@ loop: for (ip = isohashtbl[INOHASH(dev, inum)]; ip; ip = ip->i_next) { if (inum == ip->i_number && dev == ip->i_dev) { vp = ITOV(ip); - simple_lock(&vp->v_interlock); + mtx_enter(&vp->v_interlock, MTX_DEF); simple_unlock(&cd9660_ihash_slock); if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) goto loop; @@ -138,7 +140,7 @@ cd9660_ihashins(ip) *ipp = ip; simple_unlock(&cd9660_ihash_slock); - lockmgr(&ip->i_vnode->v_lock, LK_EXCLUSIVE, (struct simplelock *)0, p); + lockmgr(&ip->i_vnode->v_lock, LK_EXCLUSIVE, (struct mtx *)0, p); } /* @@ -218,6 +220,7 @@ cd9660_reclaim(ap) vrele(ip->i_devvp); ip->i_devvp = 0; } + lockdestroy(&ip->i_vnode->v_lock); FREE(vp->v_data, M_ISOFSNODE); vp->v_data = NULL; return (0); diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c index c1ed267..521db98 100644 --- a/sys/fs/coda/coda_vnops.c +++ b/sys/fs/coda/coda_vnops.c @@ -1753,6 +1753,7 @@ coda_reclaim(v) #endif } cache_purge(vp); + lockdestroy(&(VTOC(vp)->c_lock)); coda_free(VTOC(vp)); VTOC(vp) = NULL; return (0); diff --git a/sys/fs/deadfs/dead_vnops.c b/sys/fs/deadfs/dead_vnops.c index f990733..ab6678f 100644 --- a/sys/fs/deadfs/dead_vnops.c +++ b/sys/fs/deadfs/dead_vnops.c @@ -41,6 +41,8 @@ #include <sys/vnode.h> #include <sys/poll.h> +#include <machine/mutex.h> + static int chkvnlock __P((struct vnode *)); /* * Prototypes for dead operations on vnodes. @@ -210,7 +212,7 @@ dead_lock(ap) * the interlock here. */ if (ap->a_flags & LK_INTERLOCK) { - simple_unlock(&vp->v_interlock); + mtx_exit(&vp->v_interlock, MTX_DEF); ap->a_flags &= ~LK_INTERLOCK; } if (!chkvnlock(vp)) diff --git a/sys/fs/devfs/devfs_vfsops.c b/sys/fs/devfs/devfs_vfsops.c index 2956607..00951ae 100644 --- a/sys/fs/devfs/devfs_vfsops.c +++ b/sys/fs/devfs/devfs_vfsops.c @@ -96,6 +96,7 @@ devfs_mount(mp, path, data, ndp, p) error = devfs_root(mp, &rvp); if (error) { + lockdestroy(&fmp->dm_lock); FREE(fmp, M_DEVFS); return (error); } @@ -142,6 +143,7 @@ devfs_unmount(mp, mntflags, p) vrele(rootvp); vgone(rootvp); mp->mnt_data = 0; + lockdestroy(&fmp->dm_lock); free(fmp, M_DEVFS); return 0; } diff --git a/sys/fs/hpfs/hpfs.h b/sys/fs/hpfs/hpfs.h index 7c880b2..be12791 100644 --- a/sys/fs/hpfs/hpfs.h +++ b/sys/fs/hpfs/hpfs.h @@ -414,6 +414,7 @@ extern vop_t ** hpfs_vnodeop_p; /* Hash routines, too small to be separate header */ void hpfs_hphashinit __P((void)); +void hpfs_hphashdestroy __P((void)); struct hpfsnode *hpfs_hphashlookup __P((dev_t, lsn_t)); struct hpfsnode *hpfs_hphashget __P((dev_t, lsn_t)); struct vnode *hpfs_hphashvget __P((dev_t, lsn_t, struct proc *)); diff --git a/sys/fs/hpfs/hpfs_hash.c b/sys/fs/hpfs/hpfs_hash.c index a948ade..450711c 100644 --- a/sys/fs/hpfs/hpfs_hash.c +++ b/sys/fs/hpfs/hpfs_hash.c @@ -43,6 +43,8 @@ #include <sys/malloc.h> #include <sys/proc.h> +#include <machine/mutex.h> + #include <fs/hpfs/hpfs.h> MALLOC_DEFINE(M_HPFSHASH, "HPFS hash", "HPFS node hash tables"); @@ -72,6 +74,16 @@ hpfs_hphashinit() } /* + * Destroy inode hash table. + */ +void +hpfs_hphashdestroy(void) +{ + + lockdestroy(&hpfs_hphash_lock); +} + +/* * Use the device/inum pair to find the incore inode, and return a pointer * to it. If it is in core, return it, even if it is locked. */ @@ -126,7 +138,7 @@ loop: for (hp = HPNOHASH(dev, ino)->lh_first; hp; hp = hp->h_hash.le_next) { if (ino == hp->h_no && dev == hp->h_dev) { vp = HPTOV(hp); - simple_lock (&vp->v_interlock); + mtx_enter(&vp->v_interlock, MTX_DEF); simple_unlock (&hpfs_hphash_slock); if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) goto loop; diff --git a/sys/fs/hpfs/hpfs_vfsops.c b/sys/fs/hpfs/hpfs_vfsops.c index 0bb10dd..1906799 100644 --- a/sys/fs/hpfs/hpfs_vfsops.c +++ b/sys/fs/hpfs/hpfs_vfsops.c @@ -87,6 +87,7 @@ struct sockaddr; static int hpfs_mount __P((struct mount *, char *, caddr_t, struct nameidata *, struct proc *)); static int hpfs_init __P((struct vfsconf *)); +static int hpfs_uninit __P((struct vfsconf *)); static int hpfs_checkexp __P((struct mount *, struct sockaddr *, int *, struct ucred **)); #else /* defined(__NetBSD__) */ @@ -169,6 +170,16 @@ hpfs_init () #endif } +#if defined(__FreeBSD__) +static int +hpfs_uninit (vfsp) + struct vfsconf *vfsp; +{ + hpfs_hphashdestroy(); + return 0;; +} +#endif + static int hpfs_mount ( struct mount *mp, @@ -737,7 +748,7 @@ static struct vfsops hpfs_vfsops = { hpfs_checkexp, hpfs_vptofh, hpfs_init, - vfs_stduninit, + hpfs_uninit, vfs_stdextattrctl, }; VFS_SET(hpfs_vfsops, hpfs, 0); diff --git a/sys/fs/hpfs/hpfs_vnops.c b/sys/fs/hpfs/hpfs_vnops.c index dcfd2cf..f1b0b2ce 100644 --- a/sys/fs/hpfs/hpfs_vnops.c +++ b/sys/fs/hpfs/hpfs_vnops.c @@ -698,6 +698,8 @@ hpfs_reclaim(ap) hp->h_devvp = NULL; } + lockdestroy(&hp->hlock); + vp->v_data = NULL; FREE(hp, M_HPFSNO); diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 4e237bf..0122f6b 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -61,6 +61,8 @@ #include <vm/vm.h> #include <vm/vm_extern.h> +#include <machine/mutex.h> + #include <msdosfs/bpb.h> #include <msdosfs/msdosfsmount.h> #include <msdosfs/direntry.h> @@ -138,7 +140,7 @@ loop: && dev == dep->de_dev && dep->de_refcnt != 0) { vp = DETOV(dep); - simple_lock(&vp->v_interlock); + mtx_enter(&vp->v_interlock, MTX_DEF); simple_unlock(&dehash_slock); if (vget(vp, LK_EXCLUSIVE | LK_INTERLOCK, p)) goto loop; @@ -278,7 +280,7 @@ deget(pmp, dirclust, diroffset, depp) * of at the start of msdosfs_hashins() so that reinsert() can * call msdosfs_hashins() with a locked denode. */ - if (lockmgr(&ldep->de_lock, LK_EXCLUSIVE, (struct simplelock *)0, p)) + if (lockmgr(&ldep->de_lock, LK_EXCLUSIVE, (struct mtx *)0, p)) panic("deget: unexpected lock failure"); /* @@ -660,6 +662,7 @@ msdosfs_reclaim(ap) #if 0 /* XXX */ dep->de_flag = 0; #endif + lockdestroy(&dep->de_lock); FREE(dep, M_MSDOSFSNODE); vp->v_data = NULL; diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c index 33b5cd7..8af88d4 100644 --- a/sys/fs/msdosfs/msdosfs_vfsops.c +++ b/sys/fs/msdosfs/msdosfs_vfsops.c @@ -62,6 +62,8 @@ #include <sys/malloc.h> #include <sys/stat.h> /* defines ALLPERMS */ +#include <machine/mutex.h> + #include <msdosfs/bpb.h> #include <msdosfs/bootsect.h> #include <msdosfs/direntry.h> @@ -873,14 +875,14 @@ loop: if (vp->v_mount != mp) goto loop; - simple_lock(&vp->v_interlock); + mtx_enter(&vp->v_interlock, MTX_DEF); nvp = vp->v_mntvnodes.le_next; dep = VTODE(vp); if (vp->v_type == VNON || ((dep->de_flag & (DE_ACCESS | DE_CREATE | DE_UPDATE | DE_MODIFIED)) == 0 && (TAILQ_EMPTY(&vp->v_dirtyblkhd) || waitfor == MNT_LAZY))) { - simple_unlock(&vp->v_interlock); + mtx_exit(&vp->v_interlock, MTX_DEF); continue; } simple_unlock(&mntvnode_slock); diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index f8426de..37a57ea 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -68,6 +68,8 @@ #include <vm/vm_extern.h> #include <vm/vnode_pager.h> +#include <machine/mutex.h> + #include <msdosfs/bpb.h> #include <msdosfs/direntry.h> #include <msdosfs/denode.h> @@ -231,12 +233,12 @@ msdosfs_close(ap) struct denode *dep = VTODE(vp); struct timespec ts; - simple_lock(&vp->v_interlock); + mtx_enter(&vp->v_interlock, MTX_DEF); if (vp->v_usecount > 1) { getnanotime(&ts); DETIMES(dep, &ts, &ts, &ts); } - simple_unlock(&vp->v_interlock); + mtx_exit(&vp->v_interlock, MTX_DEF); return 0; } diff --git a/sys/fs/ntfs/ntfs_ihash.c b/sys/fs/ntfs/ntfs_ihash.c index 0deecff..cd2300d 100644 --- a/sys/fs/ntfs/ntfs_ihash.c +++ b/sys/fs/ntfs/ntfs_ihash.c @@ -75,6 +75,15 @@ ntfs_nthashinit() } /* + * Destroy inode hash table. + */ +void +ntfs_nthashdestroy(void) +{ + lockdestroy(&ntfs_hashlock); +} + +/* * Use the device/inum pair to find the incore inode, and return a pointer * to it. If it is in core, return it, even if it is locked. */ diff --git a/sys/fs/ntfs/ntfs_ihash.h b/sys/fs/ntfs/ntfs_ihash.h index 7b7143f..a3f166f 100644 --- a/sys/fs/ntfs/ntfs_ihash.h +++ b/sys/fs/ntfs/ntfs_ihash.h @@ -30,6 +30,7 @@ extern struct lock ntfs_hashlock; void ntfs_nthashinit __P((void)); +void ntfs_nthashdestroy __P((void)); struct ntnode *ntfs_nthashlookup __P((dev_t, ino_t)); struct ntnode *ntfs_nthashget __P((dev_t, ino_t)); void ntfs_nthashins __P((struct ntnode *)); diff --git a/sys/fs/ntfs/ntfs_inode.h b/sys/fs/ntfs/ntfs_inode.h index a86d5f7..a865276 100644 --- a/sys/fs/ntfs/ntfs_inode.h +++ b/sys/fs/ntfs/ntfs_inode.h @@ -69,7 +69,7 @@ struct ntnode { /* locking */ struct lock i_lock; - struct simplelock i_interlock; + struct mtx i_interlock; int i_usecount; LIST_HEAD(,fnode) i_fnlist; diff --git a/sys/fs/ntfs/ntfs_subr.c b/sys/fs/ntfs/ntfs_subr.c index e8f5588..f060e5b 100644 --- a/sys/fs/ntfs/ntfs_subr.c +++ b/sys/fs/ntfs/ntfs_subr.c @@ -361,7 +361,7 @@ ntfs_ntget(ip) dprintf(("ntfs_ntget: get ntnode %d: %p, usecount: %d\n", ip->i_number, ip, ip->i_usecount)); - simple_lock(&ip->i_interlock); + mtx_enter(&ip->i_interlock, MTX_DEF); ip->i_usecount++; LOCKMGR(&ip->i_lock, LK_EXCLUSIVE | LK_INTERLOCK, &ip->i_interlock); @@ -410,7 +410,7 @@ ntfs_ntlookup( /* init lock and lock the newborn ntnode */ lockinit(&ip->i_lock, PINOD, "ntnode", 0, LK_EXCLUSIVE); - simple_lock_init(&ip->i_interlock); + mtx_init(&ip->i_interlock, "ntnode interlock", MTX_DEF); ntfs_ntget(ip); ntfs_nthashins(ip); @@ -440,7 +440,7 @@ ntfs_ntput(ip) dprintf(("ntfs_ntput: rele ntnode %d: %p, usecount: %d\n", ip->i_number, ip, ip->i_usecount)); - simple_lock(&ip->i_interlock); + mtx_enter(&ip->i_interlock, MTX_DEF); ip->i_usecount--; #ifdef DIAGNOSTIC @@ -464,6 +464,10 @@ ntfs_ntput(ip) LIST_REMOVE(vap,va_list); ntfs_freentvattr(vap); } + mtx_exit(&ip->i_interlock, MTX_DEF); + mtx_destroy(&ip->i_interlock); + lockdestroy(&ip->i_lock); + FREE(ip, M_NTFSNTNODE); } else { LOCKMGR(&ip->i_lock, LK_RELEASE|LK_INTERLOCK, &ip->i_interlock); @@ -477,9 +481,9 @@ void ntfs_ntref(ip) struct ntnode *ip; { - simple_lock(&ip->i_interlock); + mtx_enter(&ip->i_interlock, MTX_DEF); ip->i_usecount++; - simple_unlock(&ip->i_interlock); + mtx_exit(&ip->i_interlock, MTX_DEF); dprintf(("ntfs_ntref: ino %d, usecount: %d\n", ip->i_number, ip->i_usecount)); @@ -496,13 +500,13 @@ ntfs_ntrele(ip) dprintf(("ntfs_ntrele: rele ntnode %d: %p, usecount: %d\n", ip->i_number, ip, ip->i_usecount)); - simple_lock(&ip->i_interlock); + mtx_enter(&ip->i_interlock, MTX_DEF); ip->i_usecount--; if (ip->i_usecount < 0) panic("ntfs_ntrele: ino: %d usecount: %d \n", ip->i_number,ip->i_usecount); - simple_unlock(&ip->i_interlock); + mtx_exit(&ip->i_interlock, MTX_DEF); } /* @@ -771,6 +775,9 @@ ntfs_frele( FREE(fp->f_attrname, M_TEMP); if (fp->f_dirblbuf) FREE(fp->f_dirblbuf, M_NTFSDIR); +#ifdef __FreeBSD__ + lockdestroy(&fp->f_lock); +#endif FREE(fp, M_NTFSFNODE); ntfs_ntrele(ip); } @@ -1915,6 +1922,13 @@ ntfs_toupper_init() ntfs_toupper_usecount = 0; } +void +ntfs_toupper_destroy(void) +{ + + lockdestroy(&ntfs_toupper_lock); +} + /* * if the ntfs_toupper_tab[] is filled already, just raise use count; * otherwise read the data from the filesystem we are currently mounting diff --git a/sys/fs/ntfs/ntfs_subr.h b/sys/fs/ntfs/ntfs_subr.h index a0cda50..8f1480a 100644 --- a/sys/fs/ntfs/ntfs_subr.h +++ b/sys/fs/ntfs/ntfs_subr.h @@ -103,6 +103,7 @@ int ntfs_loadntnode __P(( struct ntfsmount *, struct ntnode * )); int ntfs_writentvattr_plain __P((struct ntfsmount *, struct ntnode *, struct ntvattr *, off_t, size_t, void *, size_t *, struct uio *)); int ntfs_writeattr_plain __P((struct ntfsmount *, struct ntnode *, u_int32_t, char *, off_t, size_t, void *, size_t *, struct uio *)); void ntfs_toupper_init __P((void)); +void ntfs_toupper_destroy __P((void)); int ntfs_toupper_use __P((struct mount *, struct ntfsmount *)); void ntfs_toupper_unuse __P((void)); int ntfs_fget __P((struct ntfsmount *, struct ntnode *, int, char *, struct fnode **)); diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c index 77ac0d8..1b0b97a 100644 --- a/sys/fs/ntfs/ntfs_vfsops.c +++ b/sys/fs/ntfs/ntfs_vfsops.c @@ -196,9 +196,9 @@ ntfs_mountroot() return (error); } - simple_lock(&mountlist_slock); + mtx_enter(&mountlist_mtx, MTX_DEF); CIRCLEQ_INSERT_TAIL(&mountlist, mp, mnt_list); - simple_unlock(&mountlist_slock); + mtx_exit(&mountlist_mtx, MTX_DEF); (void)ntfs_statfs(mp, &mp->mnt_stat, p); vfs_unbusy(mp); return (0); @@ -222,6 +222,15 @@ ntfs_init ( return 0; } +static int +ntfs_uninit ( + struct vfsconf *vcp ) +{ + ntfs_toupper_destroy(); + ntfs_nthashdestroy(); + return 0; +} + #endif /* NetBSD */ static int @@ -1006,7 +1015,7 @@ static struct vfsops ntfs_vfsops = { ntfs_checkexp, ntfs_vptofh, ntfs_init, - vfs_stduninit, + ntfs_uninit, vfs_stdextattrctl, }; VFS_SET(ntfs_vfsops, ntfs, 0); diff --git a/sys/fs/nullfs/null_subr.c b/sys/fs/nullfs/null_subr.c index efb1357..b5df78c 100644 --- a/sys/fs/nullfs/null_subr.c +++ b/sys/fs/nullfs/null_subr.c @@ -92,8 +92,10 @@ nullfs_uninit(vfsp) struct vfsconf *vfsp; { - if (null_node_hashtbl) + if (null_node_hashtbl) { + lockdestroy(&null_hashlock); free(null_node_hashtbl, M_NULLFSHASH); + } return (0); } diff --git a/sys/fs/nwfs/nwfs_node.c b/sys/fs/nwfs/nwfs_node.c index 2d34600..03d3e86 100644 --- a/sys/fs/nwfs/nwfs_node.c +++ b/sys/fs/nwfs/nwfs_node.c @@ -83,6 +83,7 @@ nwfs_hash_init(void) { void nwfs_hash_free(void) { + lockdestroy(&nwhashlock); free(nwhashtbl, M_NWFSHASH); } diff --git a/sys/fs/nwfs/nwfs_vnops.c b/sys/fs/nwfs/nwfs_vnops.c index e309785..e7c7fa6 100644 --- a/sys/fs/nwfs/nwfs_vnops.c +++ b/sys/fs/nwfs/nwfs_vnops.c @@ -46,6 +46,8 @@ #include <vm/vm.h> #include <vm/vm_extern.h> +#include <machine/mutex.h> + #include <netncp/ncp.h> #include <netncp/ncp_conn.h> #include <netncp/ncp_subr.h> @@ -255,24 +257,24 @@ nwfs_close(ap) if (vp->v_type == VDIR) return 0; /* nothing to do now */ error = 0; - simple_lock(&vp->v_interlock); + mtx_enter(&vp->v_interlock, MTX_DEF); if (np->opened == 0) { - simple_unlock(&vp->v_interlock); + mtx_exit(&vp->v_interlock, MTX_DEF); return 0; } - simple_unlock(&vp->v_interlock); + mtx_exit(&vp->v_interlock, MTX_DEF); error = nwfs_vinvalbuf(vp, V_SAVE, ap->a_cred, ap->a_p, 1); - simple_lock(&vp->v_interlock); + mtx_enter(&vp->v_interlock, MTX_DEF); if (np->opened == 0) { - simple_unlock(&vp->v_interlock); + mtx_exit(&vp->v_interlock, MTX_DEF); return 0; } if (--np->opened == 0) { - simple_unlock(&vp->v_interlock); + mtx_exit(&vp->v_interlock, MTX_DEF); error = ncp_close_file(NWFSTOCONN(VTONWFS(vp)), &np->n_fh, ap->a_p, ap->a_cred); } else - simple_unlock(&vp->v_interlock); + mtx_exit(&vp->v_interlock, MTX_DEF); np->n_atime = 0; return (error); } diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index d1d6e31..9d34281 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -637,6 +637,7 @@ union_freevp(vp) free(un->un_path, M_TEMP); un->un_path = NULL; } + lockdestroy(&un->un_lock); FREE(vp->v_data, M_TEMP); vp->v_data = 0; |