btrfs: don't call destroy_workqueue on NULL workqueues
PATCH 1/1 btrfs: don't call destroy_workqueue on NULL workqueues
Unlike the btrfs_workueue code, the kernel workqueues don't like their cleaup function called on a NULL pointer, so add checks for them.
Fixes a5eec25648da ("btrfs: use a normal workqueue for rmw_workers")
Reported-by [email protected]
Signed-off-by Christoph Hellwig <[email protected]>
Tested-by [email protected]
--- fs/btrfs/disk-io.c | 3 ++- fs/btrfs/scrub.c | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-)
fs/btrfs/disk-io.c +2 -1
@@ -2283,7 +2283,8 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info)btrfs_destroy_workqueue (fs_info->workers);btrfs_destroy_workqueue (fs_info->endio_workers);btrfs_destroy_workqueue (fs_info->endio_raid56_workers); -destroy_workqueue (fs_info->rmw_workers); +if (fs_info->rmw_workers) +destroy_workqueue (fs_info->rmw_workers);btrfs_destroy_workqueue (fs_info->endio_write_workers);btrfs_destroy_workqueue (fs_info->endio_freespace_worker);btrfs_destroy_workqueue (fs_info->delayed_workers);
fs/btrfs/scrub.c +6 -3
@@ -3967,9 +3967,12 @@ static void scrub_workers_put(struct btrfs_fs_info *fs_info) fs_info->scrub_parity_workers =NULL ;mutex_unlock (&fs_info->scrub_lock); -destroy_workqueue (scrub_workers); -destroy_workqueue (scrub_wr_comp); -destroy_workqueue (scrub_parity); +if (scrub_workers) +destroy_workqueue (scrub_workers); +if (scrub_wr_comp) +destroy_workqueue (scrub_wr_comp); +if (scrub_parity) +destroy_workqueue (scrub_parity); } }
Signature · 1 line
2.30.2
Quoted 7 lines · Christoph Hellwig
Unlike the
btrfs_workueuecode, the kernel workqueues don't like their cleaup function called on a NULL pointer, so add checks for them.Fixes a5eec25648da ("btrfs: use a normal workqueue for rmw_workers")Reported-by [email protected]Signed-off-by Christoph Hellwig <[email protected]>Tested-by [email protected]
Thanks, folded to the patches.
fs/btrfs/disk-io.c static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info) · line 2287
Quoted 9 lines
fs/btrfs/disk-io.c +2
-1@@ -2283,7 +2283,8 @@ static void btrfs_stop_all_workers(struct btrfs_fs_info *fs_info)btrfs_destroy_workqueue (fs_info->workers);btrfs_destroy_workqueue (fs_info->endio_workers);btrfs_destroy_workqueue (fs_info->endio_raid56_workers); -destroy_workqueue (fs_info->rmw_workers); +if (fs_info->rmw_workers) +destroy_workqueue (fs_info->rmw_workers);
This is in "btrfs: use a normal workqueue for rmw_workers"
Quoted 10 lines
fs/btrfs/disk-io.c +0
-0btrfs_destroy_workqueue (fs_info->endio_write_workers);btrfs_destroy_workqueue (fs_info->endio_freespace_worker);btrfs_destroy_workqueue (fs_info->delayed_workers);fs/btrfs/scrub.c +0
-0@@ -3967,9 +3967,12 @@ static void scrub_workers_put(struct btrfs_fs_info *fs_info) fs_info->scrub_parity_workers =NULL ;mutex_unlock (&fs_info->scrub_lock);
fs/btrfs/scrub.c static void scrub_workers_put(struct btrfs_fs_info *fs_info) · line 3975
Quoted 10 lines
fs/btrfs/scrub.c +6
-3-destroy_workqueue (scrub_workers); -destroy_workqueue (scrub_wr_comp); -destroy_workqueue (scrub_parity); +if (scrub_workers) +destroy_workqueue (scrub_workers); +if (scrub_wr_comp) +destroy_workqueue (scrub_wr_comp); +if (scrub_parity) +destroy_workqueue (scrub_parity);
And this from "btrfs: use normal workqueues for scrub"