Re: negative dentry_stat.nr_unused causes aggressive dcache pruning

From: Andrew Morton
Date: Thu Dec 09 2004 - 16:17:28 EST


Steve Lord <lord@xxxxxxx> wrote:
>
> Andrew Morton wrote:
> > Steve Lord <lord@xxxxxxx> wrote:
> >
> >>I have seen this stat go negative (just from booting up a multi cpu box),
> >> and looking at the code, it is manipulated without locking in a number
> >> of places. I have only seen this in real life on a 2.4 kernel, but 2.6
> >> also looks vulnerable.
> >
> >
> > In 2.6, both dentry_stat.nr_unused and dentry_stat.nr_dentry are covered
> > by dcache_lock. I just double-checked and all seems well.
> >
>
> I still do not know exactly how the count gets negative, but I tracked it
> down to a user space app from emulex called HBAanywhere. The only thing I
> can see this doing which might be related is attempting to open a lot of
> non-existant /proc entries:
>
> /proc/scsi//120
> /proc/scsi//121
> etc...
>
> Yes there is a // in there.
>
> I ran with a BUG call if we manipulate nr_unused without the dcache lock
> and it never tripped. All very wierd.
>

Is that 2.4 or 2.6?

I'd be expecting a systematic counting bug. After all, nr_unused would
normally be in the thousands and it'd take a lot of races to get that down
to zero.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/