From 3fa33374923975732f962383339386817d5c82b6 Mon Sep 17 00:00:00 2001 From: imp Date: Thu, 10 Apr 2003 00:13:12 +0000 Subject: It appears that msdosfs_init() is called multiple times. This happens on my system where I preload msdosfs and have it in my kernel. There's likely another bug that's causing msdosfs_init() to be called multiple times, but this makes that harmless. --- sys/fs/msdosfs/msdosfs_denode.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'sys/fs/msdosfs/msdosfs_denode.c') diff --git a/sys/fs/msdosfs/msdosfs_denode.c b/sys/fs/msdosfs/msdosfs_denode.c index 735e7df..72de748 100644 --- a/sys/fs/msdosfs/msdosfs_denode.c +++ b/sys/fs/msdosfs/msdosfs_denode.c @@ -74,6 +74,7 @@ static u_long dehash; /* size of hash table - 1 */ #define DEHASH(dev, dcl, doff) (dehashtbl[(minor(dev) + (dcl) + (doff) / \ sizeof(struct direntry)) & dehash]) static struct mtx dehash_mtx; +static int dehash_init; union _qcvt { quad_t qcvt; @@ -102,6 +103,17 @@ int msdosfs_init(vfsp) struct vfsconf *vfsp; { + /* + * The following lines prevent us from initializing the mutex + * init multiple times. I'm not sure why we get called multiple + * times, but the following prevents the panic when we initalize + * the mutext the second time. XXX BAD XXX + */ + if (dehash_init) { + printf("Warning: msdosfs_init called more than once!\n"); + return (0); + } + dehash_init++; dehashtbl = hashinit(desiredvnodes/2, M_MSDOSFSMNT, &dehash); mtx_init(&dehash_mtx, "msdosfs dehash", NULL, MTX_DEF); return (0); @@ -115,6 +127,7 @@ msdosfs_uninit(vfsp) if (dehashtbl) free(dehashtbl, M_MSDOSFSMNT); mtx_destroy(&dehash_mtx); + dehash_init--; return (0); } -- cgit v1.1