diff options
author | Dmitry Monakhov <dmonakhov@openvz.org> | 2010-06-01 03:39:48 -0400 |
---|---|---|
committer | Jan Kara <jack@suse.cz> | 2010-07-21 10:01:46 -0400 |
commit | 7af9cce8ae467bb2fcf3b0b6be3898835bdb984c (patch) | |
tree | ee72b3f199b775484ad61a984d5cfd5cb34d6de8 /fs/quota | |
parent | a9f7f2e74ae0e6a801a2433dc8e9124d73da0cb4 (diff) |
quota: check quota reservation on remove_dquot_ref
Reserved space must being claimed before remove_dquot_ref() for a
given inode. Filesystem is responsible for performing force blocks
allocation in case of dealloc in ->quota_off. Let's add sanity check
for that case. Do it similar to add_dquot_ref().
Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org>
Signed-off-by: Jan Kara <jack@suse.cz>
Diffstat (limited to 'fs/quota')
-rw-r--r-- | fs/quota/dquot.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/fs/quota/dquot.c b/fs/quota/dquot.c index 12c233da1b6b..a5974c49a78b 100644 --- a/fs/quota/dquot.c +++ b/fs/quota/dquot.c | |||
@@ -986,6 +986,7 @@ static void remove_dquot_ref(struct super_block *sb, int type, | |||
986 | struct list_head *tofree_head) | 986 | struct list_head *tofree_head) |
987 | { | 987 | { |
988 | struct inode *inode; | 988 | struct inode *inode; |
989 | int reserved = 0; | ||
989 | 990 | ||
990 | spin_lock(&inode_lock); | 991 | spin_lock(&inode_lock); |
991 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { | 992 | list_for_each_entry(inode, &sb->s_inodes, i_sb_list) { |
@@ -995,10 +996,20 @@ static void remove_dquot_ref(struct super_block *sb, int type, | |||
995 | * only quota pointers and these have separate locking | 996 | * only quota pointers and these have separate locking |
996 | * (dqptr_sem). | 997 | * (dqptr_sem). |
997 | */ | 998 | */ |
998 | if (!IS_NOQUOTA(inode)) | 999 | if (!IS_NOQUOTA(inode)) { |
1000 | if (unlikely(inode_get_rsv_space(inode) > 0)) | ||
1001 | reserved = 1; | ||
999 | remove_inode_dquot_ref(inode, type, tofree_head); | 1002 | remove_inode_dquot_ref(inode, type, tofree_head); |
1003 | } | ||
1000 | } | 1004 | } |
1001 | spin_unlock(&inode_lock); | 1005 | spin_unlock(&inode_lock); |
1006 | #ifdef CONFIG_QUOTA_DEBUG | ||
1007 | if (reserved) { | ||
1008 | printk(KERN_WARNING "VFS (%s): Writes happened after quota" | ||
1009 | " was disabled thus quota information is probably " | ||
1010 | "inconsistent. Please run quotacheck(8).\n", sb->s_id); | ||
1011 | } | ||
1012 | #endif | ||
1002 | } | 1013 | } |
1003 | 1014 | ||
1004 | /* Gather all references from inodes and drop them */ | 1015 | /* Gather all references from inodes and drop them */ |