Skip to content

Commit 7af9cce

Browse files
Dmitry Monakhovjankara
authored andcommitted
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>
1 parent a9f7f2e commit 7af9cce

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

‎fs/quota/dquot.c‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,6 +986,7 @@ static void remove_dquot_ref(struct super_block *sb, int type,
986986
struct list_head *tofree_head)
987987
{
988988
struct inode *inode;
989+
int reserved = 0;
989990

990991
spin_lock(&inode_lock);
991992
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,
995996
* only quota pointers and these have separate locking
996997
* (dqptr_sem).
997998
*/
998-
if (!IS_NOQUOTA(inode))
999+
if (!IS_NOQUOTA(inode)) {
1000+
if (unlikely(inode_get_rsv_space(inode) > 0))
1001+
reserved = 1;
9991002
remove_inode_dquot_ref(inode, type, tofree_head);
1003+
}
10001004
}
10011005
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
10021013
}
10031014

10041015
/* Gather all references from inodes and drop them */

0 commit comments

Comments
 (0)