public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Christoph Hellwig <hch@lst.de>
Cc: dsterba@suse.com, josef@toxicpanda.com,
	linux-btrfs@vger.kernel.org,
	syzbot+a2c720e0f056114ea7c6@syzkaller.appspotmail.com
Subject: Re: [PATCH] btrfs: don't call destroy_workqueue on NULL workqueues
Date: Thu, 28 Apr 2022 17:02:37 +0200	[thread overview]
Message-ID: <20220428150237.GC18596@twin.jikos.cz> (raw)
In-Reply-To: <20220428125341.4152527-1-hch@lst.de>

On Thu, Apr 28, 2022 at 05:53:41AM -0700, Christoph Hellwig wrote:
> 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: syzbot+a2c720e0f056114ea7c6@syzkaller.appspotmail.com
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> Tested-by: syzbot+a2c720e0f056114ea7c6@syzkaller.appspotmail.com

Thanks, folded to the patches.

> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -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"

>  	btrfs_destroy_workqueue(fs_info->endio_write_workers);
>  	btrfs_destroy_workqueue(fs_info->endio_freespace_worker);
>  	btrfs_destroy_workqueue(fs_info->delayed_workers);
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index a614ddde8c624..3985225f27be5 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -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);

And this from "btrfs: use normal workqueues for scrub"

      reply	other threads:[~2022-04-28 15:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-28 12:53 [PATCH] btrfs: don't call destroy_workqueue on NULL workqueues Christoph Hellwig
2022-04-28 15:02 ` David Sterba [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220428150237.GC18596@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=dsterba@suse.com \
    --cc=hch@lst.de \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=syzbot+a2c720e0f056114ea7c6@syzkaller.appspotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox