btrfs: fall back to global reservation when removing subvolumes

I recently did some ENOSPC testing that involved filling the disk
while create and removing snapshots in a loop. During the test cycle,
I ran into an ENOSPC when trying to remove a snapshot, leaving the fs
stuck in ENOSPC even after a umount/mount cycle.

This patch allow subvolume removal to fall back onto the global
block reservation in order to succeed when it would have failed
otherwise.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
This commit is contained in:
Jeff Mahoney
2013-07-09 16:37:21 -04:00
committed by Chris Mason
parent 74be951087
commit ee3441b490
3 changed files with 12 additions and 5 deletions

View File

@@ -396,7 +396,7 @@ static noinline int create_subvol(struct inode *dir,
* of create_snapshot().
*/
ret = btrfs_subvolume_reserve_metadata(root, &block_rsv,
7, &qgroup_reserved);
7, &qgroup_reserved, false);
if (ret)
return ret;
@@ -576,7 +576,8 @@ static int create_snapshot(struct btrfs_root *root, struct inode *dir,
*/
ret = btrfs_subvolume_reserve_metadata(BTRFS_I(dir)->root,
&pending_snapshot->block_rsv, 7,
&pending_snapshot->qgroup_reserved);
&pending_snapshot->qgroup_reserved,
false);
if (ret)
goto out;
@@ -2174,7 +2175,7 @@ static noinline int btrfs_ioctl_snap_destroy(struct file *file,
* ref/backref.
*/
err = btrfs_subvolume_reserve_metadata(root, &block_rsv,
5, &qgroup_reserved);
5, &qgroup_reserved, true);
if (err)
goto out_up_write;