Skip to content

Commit a690e5f

Browse files
naotakdave
authored andcommitted
btrfs: mark resumed async balance as writing
When btrfs balance is interrupted with umount, the background balance resumes on the next mount. There is a potential deadlock with FS freezing here like as described in commit 2655978 ("btrfs: zoned: mark relocation as writing"). Mark the process as sb_writing to avoid it. Reviewed-by: Filipe Manana <fdmanana@suse.com> CC: stable@vger.kernel.org # 4.9+ Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Reviewed-by: David Sterba <dsterba@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent d03ae0d commit a690e5f

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

fs/btrfs/volumes.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4430,10 +4430,12 @@ static int balance_kthread(void *data)
44304430
struct btrfs_fs_info *fs_info = data;
44314431
int ret = 0;
44324432

4433+
sb_start_write(fs_info->sb);
44334434
mutex_lock(&fs_info->balance_mutex);
44344435
if (fs_info->balance_ctl)
44354436
ret = btrfs_balance(fs_info, fs_info->balance_ctl, NULL);
44364437
mutex_unlock(&fs_info->balance_mutex);
4438+
sb_end_write(fs_info->sb);
44374439

44384440
return ret;
44394441
}

0 commit comments

Comments
 (0)