On Sun, Feb 09, 2003 at 06:08:47PM -0500, Mike Makonnen wrote:

> How about the attached?
> 
> It's only partially tested since it seems I can't mount any msdos floppies (both
> on this _and_ my previous kernel).

> Index: sys/fs/msdosfs/msdosfs_denode.c
> ===================================================================
> RCS file: /home/ncvs/src/sys/fs/msdosfs/msdosfs_denode.c,v
> retrieving revision 1.67
> diff -u -r1.67 msdosfs_denode.c
> --- sys/fs/msdosfs/msdosfs_denode.c   21 Jan 2003 08:55:46 -0000      1.67
> +++ sys/fs/msdosfs/msdosfs_denode.c   9 Feb 2003 22:14:41 -0000
> @@ -73,6 +73,12 @@
>  static u_long dehash;                        /* size of hash table - 1 */
>  #define      DEHASH(dev, dcl, doff)  (dehashtbl[(minor(dev) + (dcl) + (doff) / 
> \                             sizeof(struct direntry)) & dehash])
> +#define DEHASH_INIT  do {\
> +     if (dehashtbl == NULL) {\
> +             dehashtbl = hashinit(desiredvnodes/2, M_MSDOSFSMNT, &dehash);\
> +             KASSERT(dehashtbl != NULL, "msdosfs dehashtbl == NULL");\
> +     }\
> +     } while (0)
>  static struct mtx dehash_mtx;
>  
>  union _qcvt {
[...]
> @@ -130,6 +138,7 @@
>  
>  loop:
>       mtx_lock(&dehash_mtx);
> +     DEHASH_INIT;
>       for (dep = DEHASH(dev, dirclust, diroff); dep; dep = dep->de_next) {
>               if (dirclust == dep->de_dirclust
>                   && diroff == dep->de_diroffset

hashinit() can sleep, and I don't think it's safe to sleep here
(msdosfs_hashget() and msdosfs_hashins()) with dehash_mtx and
sometimes a vnode lock held.

It might be better to initialise the table the first time an
msdosfs filesystem is mounted.


Tim

To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to