Re: [xfs-masters] RFC: Fix f_flags races without the BKL

From: Christoph Hellwig
Date: Tue Dec 30 2008 - 09:49:22 EST


On Tue, Dec 30, 2008 at 02:37:37PM +0100, Andi Kleen wrote:
> That's not clear. Mutexes can be much slower than a spinlock
> like BKL in some situations, mostly because they schedule more and
> have generally more overhead.
>
> As long as you don't have another BKL user contending the BKL
> is likely faster than the mutex.

Note that I did not say faster, but better. The subtle races the
BKL semantics introduce are nasty.

That beeing said I took another look at the patch and it seems like
most places are indeed just very quick flags setting / clearing
with the only sleeping possible inside ->fasync. So having a
file_flags_lock spinlock, and another sleeping mutex protecting
->fasync might be another options.

Jon, do you remember what we actually need to protect in -fasync?
any reason not to take the locking inside the method? Together with
->lock and the old ->ioctl it's pretty special in fops as none of
the others have any locking at all.

>
> -Andi
>
> --
> ak@xxxxxxxxxxxxxxx
>
> _______________________________________________
> xfs-masters mailing list
> xfs-masters@xxxxxxxxxxx
> http://oss.sgi.com/mailman/listinfo/xfs-masters
---end quoted text---
--
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/