diff options
| author | Andrew Morton <akpm@digeo.com> | 2003-02-05 16:57:04 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2003-02-05 16:57:04 -0800 |
| commit | 50d49a05cad3675a8a846ed128df8880f1ef3955 (patch) | |
| tree | e721d6c4c43f8adc4bfb81d340c237ac7a6dfe7e /include/linux | |
| parent | 0b3166209169b1c552ab0684305b75810d5e292e (diff) | |
[PATCH] Fix SMP race betwen __sync_single_inode and
Patch from Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
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.
CPU 1
modify inode
(but modifications are in cpu-local
buffer and do not go to bus)
calls
__mark_inode_dirty
it sees I_DIRTY and exits immediatelly
CPU 2
takes spinlock
calls __sync_single_inode
inode->i_state &= ~I_DIRTY
writes the inode (but does not see
modifications by CPU 1 yet)
CPU 1 flushes its write buffer to the bus
inode is already written, clean, modifications
done by CPU1 are lost
The easiest fix would be to move the test inside spinlock in
__mark_inode_dirty; if you do not want to suffer from performance loss,
use the attached patches that use memory barriers to ensure ordering of
reads and writes.
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions
