Skip to content

Commit 8e3dffc

Browse files
Wang Shilongjankara
authored andcommitted
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 <[email protected]> Signed-off-by: Jan Kara <[email protected]>
1 parent 98783e4 commit 8e3dffc

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

fs/ext2/balloc.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -568,8 +568,11 @@ void ext2_free_blocks (struct inode * inode, unsigned long block,
568568
}
569569
error_return:
570570
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+
}
573576
}
574577

575578
/**
@@ -1412,9 +1415,11 @@ ext2_fsblk_t ext2_new_blocks(struct inode *inode, ext2_fsblk_t goal,
14121415

14131416
*errp = 0;
14141417
brelse(bitmap_bh);
1415-
dquot_free_block_nodirty(inode, *count-num);
1416-
mark_inode_dirty(inode);
1417-
*count = num;
1418+
if (num < *count) {
1419+
dquot_free_block_nodirty(inode, *count-num);
1420+
mark_inode_dirty(inode);
1421+
*count = num;
1422+
}
14181423
return ret_block;
14191424

14201425
io_error:

0 commit comments

Comments
 (0)