Skip to content

Commit 800ee22

Browse files
Sergei Trofimovichmasoncl
authored andcommitted
btrfs: fix crash in remount(thread_pool=) case
Reproducer: mount /dev/ubda /mnt mount -oremount,thread_pool=42 /mnt Gives a crash: ? btrfs_workqueue_set_max+0x0/0x70 btrfs_resize_thread_pool+0xe3/0xf0 ? sync_filesystem+0x0/0xc0 ? btrfs_resize_thread_pool+0x0/0xf0 btrfs_remount+0x1d2/0x570 ? kern_path+0x0/0x80 do_remount_sb+0xd9/0x1c0 do_mount+0x26a/0xbf0 ? kfree+0x0/0x1b0 SyS_mount+0xc4/0x110 It's a call btrfs_workqueue_set_max(fs_info->scrub_wr_completion_workers, new_pool_size); with fs_info->scrub_wr_completion_workers = NULL; as scrub wqs get created only on user's demand. Patch skips not-created-yet workqueues. Signed-off-by: Sergei Trofimovich <[email protected]> CC: Qu Wenruo <[email protected]> CC: Chris Mason <[email protected]> CC: Josef Bacik <[email protected]> CC: [email protected] Signed-off-by: Chris Mason <[email protected]>
1 parent c4a050b commit 800ee22

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

fs/btrfs/async-thread.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,8 @@ void btrfs_destroy_workqueue(struct btrfs_workqueue *wq)
323323

324324
void btrfs_workqueue_set_max(struct btrfs_workqueue *wq, int max)
325325
{
326+
if (!wq)
327+
return;
326328
wq->normal->max_active = max;
327329
if (wq->high)
328330
wq->high->max_active = max;

0 commit comments

Comments
 (0)