Message ID | 1341567096-30304-1-git-send-email-liubo2009@cn.fujitsu.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index 5775dc4..0469398 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -5777,7 +5777,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;
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 <liubo2009@cn.fujitsu.com> --- v1->v2: adopt an easier and cleaner way: checking return value instead of adding more arguments. fs/btrfs/extent-tree.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-)