aboutsummaryrefslogtreecommitdiffstats
path: root/fs/dquot.c
diff options
context:
space:
mode:
authorNick Piggin <npiggin@suse.de>2009-03-11 16:17:36 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2009-03-27 14:44:05 -0400
commitaabb8fdb41128705fd1627f56fdd571e45fdbcdb (patch)
treebae6e9abf167cf20b9a2d3e5c38520d3f17b777d /fs/dquot.c
parent1bd7903560f1f713e85188a5aaf4d2428b6c8b50 (diff)
fs: avoid I_NEW inodes
To be on the safe side, it should be less fragile to exclude I_NEW inodes from inode list scans by default (unless there is an important reason to have them). Normally they will get excluded (eg. by zero refcount or writecount etc), however it is a bit fragile for list walkers to know exactly what parts of the inode state is set up and valid to test when in I_NEW. So along these lines, move I_NEW checks upward as well (sometimes taking I_FREEING etc checks with them too -- this shouldn't be a problem should it?) Signed-off-by: Nick Piggin <npiggin@suse.de> Acked-by: Jan Kara <jack@suse.cz> Cc: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dquot.c')
-rw-r--r--fs/dquot.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/dquot.c b/fs/dquot.c
index bca3cac4bee7..cb1c3bc324de 100644
--- a/fs/dquot.c
+++ b/fs/dquot.c
@@ -789,12 +789,12 @@ static void add_dquot_ref(struct super_block *sb, int type)
789 789
790 spin_lock(&inode_lock); 790 spin_lock(&inode_lock);
791 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { 791 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
792 if (inode->i_state & (I_FREEING|I_WILL_FREE|I_NEW))
793 continue;
792 if (!atomic_read(&inode->i_writecount)) 794 if (!atomic_read(&inode->i_writecount))
793 continue; 795 continue;
794 if (!dqinit_needed(inode, type)) 796 if (!dqinit_needed(inode, type))
795 continue; 797 continue;
796 if (inode->i_state & (I_FREEING|I_WILL_FREE))
797 continue;
798 798
799 __iget(inode); 799 __iget(inode);
800 spin_unlock(&inode_lock); 800 spin_unlock(&inode_lock);
@@ -870,6 +870,12 @@ static void remove_dquot_ref(struct super_block *sb, int type,
870 870
871 spin_lock(&inode_lock); 871 spin_lock(&inode_lock);
872 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { 872 list_for_each_entry(inode, &sb->s_inodes, i_sb_list) {
873 /*
874 * We have to scan also I_NEW inodes because they can already
875 * have quota pointer initialized. Luckily, we need to touch
876 * only quota pointers and these have separate locking
877 * (dqptr_sem).
878 */
873 if (!IS_NOQUOTA(inode)) 879 if (!IS_NOQUOTA(inode))
874 remove_inode_dquot_ref(inode, type, tofree_head); 880 remove_inode_dquot_ref(inode, type, tofree_head);
875 } 881 }