Commit 9f0ccfd8 authored by Mingming Cao's avatar Mingming Cao Committed by Theodore Ts'o

ext4: release reserved quota when block reservation for delalloc retry

ext4_da_reserve_space() can reserve quota blocks multiple times if
ext4_claim_free_blocks() fail and we retry the allocation. We should
release the quota reservation before restarting.

Bug found by Jan Kara.
Signed-off-by: default avatarMingming Cao <cmm@us.ibm.com>
Signed-off-by: default avatar"Theodore Ts'o" <tytso@mit.edu>
parent 55138e0b
...@@ -1854,11 +1854,11 @@ static int ext4_da_reserve_space(struct inode *inode, int nrblocks) ...@@ -1854,11 +1854,11 @@ static int ext4_da_reserve_space(struct inode *inode, int nrblocks)
if (ext4_claim_free_blocks(sbi, total)) { if (ext4_claim_free_blocks(sbi, total)) {
spin_unlock(&EXT4_I(inode)->i_block_reservation_lock); spin_unlock(&EXT4_I(inode)->i_block_reservation_lock);
vfs_dq_release_reservation_block(inode, total);
if (ext4_should_retry_alloc(inode->i_sb, &retries)) { if (ext4_should_retry_alloc(inode->i_sb, &retries)) {
yield(); yield();
goto repeat; goto repeat;
} }
vfs_dq_release_reservation_block(inode, total);
return -ENOSPC; return -ENOSPC;
} }
EXT4_I(inode)->i_reserved_data_blocks += nrblocks; EXT4_I(inode)->i_reserved_data_blocks += nrblocks;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment