--- linux/fs/inode.c_ Sat Aug 3 01:39:44 2002 +++ linux/fs/inode.c Sun Feb 2 23:21:40 2003 @@ -147,6 +147,10 @@ sb->s_op->dirty_inode(inode); } + /* make sure that changes are seen by all cpus before we test i_state + -- mikulas */ + smp_mb(); + /* avoid the locking if we can */ if ((inode->i_state & flags) == flags) return; @@ -219,6 +223,11 @@ dirty = inode->i_state & I_DIRTY; inode->i_state |= I_LOCK; inode->i_state &= ~I_DIRTY; + + smp_rmb(); /* mark_inode_dirty doesn't take spinlock, make sure + that inode is not read speculatively by this cpu + before &= ~I_DIRTY -- mikulas */ + spin_unlock(&inode_lock); filemap_fdatasync(inode->i_mapping);