Skip to content

Commit 3ec9a4c

Browse files
josefbacikkdave
authored andcommitted
btrfs: run delayed iputs before committing
Delayed iputs means we can have final iputs of deleted inodes in the queue, which could potentially generate a lot of pinned space that could be free'd. So before we decide to commit the transaction for ENOPSC reasons, run the delayed iputs so that any potential space is free'd up. If there is and we freed enough we can then commit the transaction and potentially be able to make our reservation. Reviewed-by: Omar Sandoval <osandov@fb.com> Signed-off-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 74d5d22 commit 3ec9a4c

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

fs/btrfs/extent-tree.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4952,6 +4952,15 @@ static void flush_space(struct btrfs_fs_info *fs_info,
49524952
ret = 0;
49534953
break;
49544954
case COMMIT_TRANS:
4955+
/*
4956+
* If we have pending delayed iputs then we could free up a
4957+
* bunch of pinned space, so make sure we run the iputs before
4958+
* we do our pinned bytes check below.
4959+
*/
4960+
mutex_lock(&fs_info->cleaner_delayed_iput_mutex);
4961+
btrfs_run_delayed_iputs(fs_info);
4962+
mutex_unlock(&fs_info->cleaner_delayed_iput_mutex);
4963+
49554964
ret = may_commit_transaction(fs_info, space_info);
49564965
break;
49574966
default:

0 commit comments

Comments
 (0)