Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1854,11 +1854,11 @@ static int ext4_da_reserve_space(struct inode *inode, int nrblocks)

	if (ext4_claim_free_blocks(sbi, total)) {
		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)) {
			yield();
			goto repeat;
		}
		vfs_dq_release_reservation_block(inode, total);
		return -ENOSPC;
	}
	EXT4_I(inode)->i_reserved_data_blocks += nrblocks;