Re: [PATCH] remove BKL from ext2's readdir

From: Andrew Morton (akpm@digeo.com)
Date: Sat Mar 15 2003 - 05:36:14 EST


Alex Tomas <bzzz@tmi.comex.ru> wrote:
>
>
> hi!
>
> I took a look at readdir() in 2.5.64's ext2 and found it serialized by BKL.

Yes, I had this in -mm for ages, seem to have lost it. Also removal of BKL
from lseek().

The theory is that the lock is there to avoid f_pos races against lseek. We
ended up deciding that the way to address this is to ensure that all readdir
implementations do:

foo_readdir()
{
        loff_t pos = file->f_pos;

        ....
        <code which doesn't touch file->f_pos, but which modifies pos>
        ...

        file->f_pos = pos;
}

ext2 does this right and does not need the lock_kernel(). Once all
filesystems have been audited (and, if necessary, fixed) we can remove the
BKL from lseek also.

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



This archive was generated by hypermail 2b29 : Sat Mar 15 2003 - 22:00:43 EST