Re: [xfs-masters] RFC: Fix f_flags races without the BKL
From: Jonathan Corbet
Date: Wed Dec 31 2008 - 04:52:44 EST
On Tue, 30 Dec 2008 15:48:37 +0100
Christoph Hellwig <hch@xxxxxx> wrote:
> 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.
There's nothing special about fasync() itself. The problem is that the
setting of the FASYNC flag and the associated call to fasync() need to
be atomic, lest the driver/filesystem and the VFS end up with differing
ideas about the setting of that flag. In the absence of that
constraint, one could just use the normal bit operations on f_flags.
jon
--
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/