Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Ext2: mark inode dirty after the function dquot_free_block_nodirty is called

We should mark inode dirty after the function dquot_free_block_nodirty
is called.Besides,add a check whether it is necessary to call
dquot_free_block_nodirty functon.

Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
Signed-off-by: Jan Kara <jack@suse.cz>

authored by

Wang Shilong and committed by
Jan Kara
8e3dffc6 98783e45

+10 -5
+10 -5
fs/ext2/balloc.c
··· 568 568 } 569 569 error_return: 570 570 brelse(bitmap_bh); 571 - release_blocks(sb, freed); 572 - dquot_free_block_nodirty(inode, freed); 571 + if (freed) { 572 + release_blocks(sb, freed); 573 + dquot_free_block_nodirty(inode, freed); 574 + mark_inode_dirty(inode); 575 + } 573 576 } 574 577 575 578 /** ··· 1415 1412 1416 1413 *errp = 0; 1417 1414 brelse(bitmap_bh); 1418 - dquot_free_block_nodirty(inode, *count-num); 1419 - mark_inode_dirty(inode); 1420 - *count = num; 1415 + if (num < *count) { 1416 + dquot_free_block_nodirty(inode, *count-num); 1417 + mark_inode_dirty(inode); 1418 + *count = num; 1419 + } 1421 1420 return ret_block; 1422 1421 1423 1422 io_error: