fs: protect inode->i_state with inode->i_lock
authorDave Chinner <dchinner@redhat.com>
Tue, 22 Mar 2011 11:23:36 +0000 (22:23 +1100)
committerAl Viro <viro@zeniv.linux.org.uk>
Fri, 25 Mar 2011 01:16:31 +0000 (21:16 -0400)
commit250df6ed274d767da844a5d9f05720b804240197
treeb74f49a86c4451d9e3e82f90e3f791163025be21
parent3dc8fe4dca9cd3e4aa828ed36451e2bcfd2350da
fs: protect inode->i_state with inode->i_lock

Protect inode state transitions and validity checks with the
inode->i_lock. This enables us to make inode state transitions
independently of the inode_lock and is the first step to peeling
away the inode_lock from the code.

This requires that __iget() is done atomically with i_state checks
during list traversals so that we don't race with another thread
marking the inode I_FREEING between the state check and grabbing the
reference.

Also remove the unlock_new_inode() memory barrier optimisation
required to avoid taking the inode_lock when clearing I_NEW.
Simplify the code by simply taking the inode->i_lock around the
state change and wakeup. Because the wakeup is no longer tricky,
remove the wake_up_inode() function and open code the wakeup where
necessary.

Signed-off-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/block_dev.c
fs/buffer.c
fs/drop_caches.c
fs/fs-writeback.c
fs/inode.c
fs/notify/inode_mark.c
fs/quota/dquot.c
include/linux/fs.h
include/linux/quotaops.h
mm/filemap.c
mm/rmap.c