mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 02:32:09 -04:00
introduce I_SYNC
I_LOCK was used for several unrelated purposes, which caused deadlock situations in certain filesystems as a side effect. One of the purposes now uses the new I_SYNC bit. Also document the various bits and change their order from historical to logical. [[email protected]: make fs/inode.c:wake_up_inode() static] Signed-off-by: Joern Engel <[email protected]> Cc: Dave Kleikamp <[email protected]> Cc: David Chinner <[email protected]> Cc: Anton Altaparmakov <[email protected]> Cc: Al Viro <[email protected]> Cc: Christoph Hellwig <[email protected]> Signed-off-by: Adrian Bunk <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
2e6883bdf4
commit
1c0eeaf569
8 changed files with 116 additions and 42 deletions
24
fs/inode.c
24
fs/inode.c
|
|
@ -99,6 +99,15 @@ struct inodes_stat_t inodes_stat;
|
|||
|
||||
static struct kmem_cache * inode_cachep __read_mostly;
|
||||
|
||||
static void wake_up_inode(struct inode *inode)
|
||||
{
|
||||
/*
|
||||
* Prevent speculative execution through spin_unlock(&inode_lock);
|
||||
*/
|
||||
smp_mb();
|
||||
wake_up_bit(&inode->i_state, __I_LOCK);
|
||||
}
|
||||
|
||||
static struct inode *alloc_inode(struct super_block *sb)
|
||||
{
|
||||
static const struct address_space_operations empty_aops;
|
||||
|
|
@ -232,7 +241,7 @@ void __iget(struct inode * inode)
|
|||
return;
|
||||
}
|
||||
atomic_inc(&inode->i_count);
|
||||
if (!(inode->i_state & (I_DIRTY|I_LOCK)))
|
||||
if (!(inode->i_state & (I_DIRTY|I_SYNC)))
|
||||
list_move(&inode->i_list, &inode_in_use);
|
||||
inodes_stat.nr_unused--;
|
||||
}
|
||||
|
|
@ -253,7 +262,7 @@ void clear_inode(struct inode *inode)
|
|||
BUG_ON(inode->i_data.nrpages);
|
||||
BUG_ON(!(inode->i_state & I_FREEING));
|
||||
BUG_ON(inode->i_state & I_CLEAR);
|
||||
wait_on_inode(inode);
|
||||
inode_sync_wait(inode);
|
||||
DQUOT_DROP(inode);
|
||||
if (inode->i_sb->s_op->clear_inode)
|
||||
inode->i_sb->s_op->clear_inode(inode);
|
||||
|
|
@ -1071,7 +1080,7 @@ static void generic_forget_inode(struct inode *inode)
|
|||
struct super_block *sb = inode->i_sb;
|
||||
|
||||
if (!hlist_unhashed(&inode->i_hash)) {
|
||||
if (!(inode->i_state & (I_DIRTY|I_LOCK)))
|
||||
if (!(inode->i_state & (I_DIRTY|I_SYNC)))
|
||||
list_move(&inode->i_list, &inode_unused);
|
||||
inodes_stat.nr_unused++;
|
||||
if (sb->s_flags & MS_ACTIVE) {
|
||||
|
|
@ -1314,15 +1323,6 @@ static void __wait_on_freeing_inode(struct inode *inode)
|
|||
spin_lock(&inode_lock);
|
||||
}
|
||||
|
||||
void wake_up_inode(struct inode *inode)
|
||||
{
|
||||
/*
|
||||
* Prevent speculative execution through spin_unlock(&inode_lock);
|
||||
*/
|
||||
smp_mb();
|
||||
wake_up_bit(&inode->i_state, __I_LOCK);
|
||||
}
|
||||
|
||||
/*
|
||||
* We rarely want to lock two inodes that do not have a parent/child
|
||||
* relationship (such as directory, child inode) simultaneously. The
|
||||
|
|
|
|||
Loading…
Reference in a new issue