Re: 2.4, 2.5: SMP race: __sync_single_inode vs. __mark_inode_dirty

From: Andrew Morton (akpm@digeo.com)
Date: Sun Feb 02 2003 - 19:06:56 EST


Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz> wrote:
>
> Hi.
>
> there's a SMP race condition between __sync_single_inode (or __sync_one on
> 2.4.20) and __mark_inode_dirty. __mark_inode_dirty doesn't take inode
> spinlock. As we know -- unless you take a spinlock or use barrier,
> processor can change order of instructions.
>

Looks good to me, although my understanding of these memory ordering issues
is woeful.

We do want to avoid taking inode_lock in mark_inode_dirty() - that is called
very frequently. I'm rather surprised that inode_lock contention has not
been a problem thus far.

Longer-term we should probably turn i_state into a ulong and only run atomic
bitops against it.

-
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 : Fri Feb 07 2003 - 22:00:09 EST