diff options
author | imp <imp@FreeBSD.org> | 2003-04-10 00:13:12 +0000 |
---|---|---|
committer | imp <imp@FreeBSD.org> | 2003-04-10 00:13:12 +0000 |
commit | 3fa33374923975732f962383339386817d5c82b6 (patch) | |
tree | 8058e3128f99114fe49e0ff185dc74efa13f2ae9 | |
parent | d32093d636ee42726dd34adf6e30a23c1f060036 (diff) | |
download | FreeBSD-src-3fa33374923975732f962383339386817d5c82b6.zip FreeBSD-src-3fa33374923975732f962383339386817d5c82b6.tar.gz |
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.
-rw-r--r-- | sys/fs/msdosfs/msdosfs_denode.c | 13 |
1 files changed, 13 insertions, 0 deletions
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); } |