Skip to content

Commit

Permalink
Btrfs: do not abort transaction in prealloc case
Browse files Browse the repository at this point in the history
During disk balance, we prealloc new file extent for file data relocation,
but we may fail in 'no available space' case, and it leads to flipping btrfs
into readonly.

It is not necessary to bail out and abort transaction since we do have several
ways to rescue ourselves from ENOSPC case.

Signed-off-by: Liu Bo <[email protected]>
Signed-off-by: Josef Bacik <[email protected]>
  • Loading branch information
liub authored and Chris Mason committed Jul 23, 2012
1 parent 83eea1f commit 0678938
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/btrfs/extent-tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -5748,7 +5748,11 @@ static noinline int find_free_extent(struct btrfs_trans_handle *trans,
ret = do_chunk_alloc(trans, root, num_bytes +
2 * 1024 * 1024, data,
CHUNK_ALLOC_LIMITED);
if (ret < 0) {
/*
* Do not bail out on ENOSPC since we
* can do more things.
*/
if (ret < 0 && ret != -ENOSPC) {
btrfs_abort_transaction(trans,
root, ret);
goto out;
Expand Down

0 comments on commit 0678938

Please sign in to comment.