]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
ext4: release reserved quota when block reservation for delalloc retry
authorMingming Cao <cmm@us.ibm.com>
Mon, 28 Sep 2009 19:49:52 +0000 (15:49 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Mon, 28 Sep 2009 19:49:52 +0000 (15:49 -0400)
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: Mingming Cao <cmm@us.ibm.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/inode.c

index 20e2d704dc2ef7b45ae1296b3dde4121da47d1e9..219067ce09d97074ee2595b915ecf34e93b29aab 100644 (file)
@@ -1854,11 +1854,11 @@ repeat:
 
        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;