From: Liu Bo Date: Fri, 6 Jul 2012 09:31:33 +0000 (-0600) Subject: Btrfs: do not abort transaction in prealloc case X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=067893842341e7b7487062367ecfaa46c97505e0;p=GitHub%2FLineageOS%2Fandroid_kernel_samsung_universal7580.git Btrfs: do not abort transaction in prealloc case 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 Signed-off-by: Josef Bacik --- diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index d1ebd2a0611..67bd12a5236 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -5748,7 +5748,11 @@ loop: 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;