On 09/21/2016 02:59 AM, Wang Xiaoguang wrote:
Indeed as long as we have delalloc bytes and if we fail to reclaim
requested metadata space, we should write these delalloc bytes and
have one more try, this can fix some false enospc errors in some
extreme cases.

Signed-off-by: Wang Xiaoguang <wangxg.f...@cn.fujitsu.com>
---
 fs/btrfs/extent-tree.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index fdfc97f..46c2a37 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -4794,6 +4794,15 @@ static int may_commit_transaction(struct btrfs_root 
*root,
 {
        struct btrfs_block_rsv *delayed_rsv = &root->fs_info->delayed_block_rsv;
        struct btrfs_trans_handle *trans;
+       struct btrfs_fs_info *fs_info = root->fs_info;
+
+       /*
+        * shrink_delalloc() may not write enough delalloc bytes, so here we
+        * have a last try. Please don't remove these, because these can fix
+        * some false enospc error in some extreme cases.
+        */
+       btrfs_start_delalloc_roots(fs_info, 0, -1);
+       btrfs_wait_ordered_roots(fs_info, -1, 0, (u64)-1);

        trans = (struct btrfs_trans_handle *)current->journal_info;
        if (trans)


This will deadlock.

Josef
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to