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. [bunk@stusta.de: make fs/inode.c:wake_up_inode() static] Signed-off-by: Joern Engel <joern@wohnheim.fh-wedel.de> Cc: Dave Kleikamp <shaggy@linux.vnet.ibm.com> Cc: David Chinner <dgc@sgi.com> Cc: Anton Altaparmakov <aia21@cam.ac.uk> Cc: Al Viro <viro@ftp.linux.org.uk> Cc: Christoph Hellwig <hch@infradead.org> Signed-off-by: Adrian Bunk <bunk@stusta.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
committed by
Linus Torvalds
parent
2e6883bdf4
commit
1c0eeaf569
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
|
||||
|
Reference in New Issue
Block a user