public inbox for linux-rdma@vger.kernel.org
 help / color / mirror / Atom feed
From: Leon Romanovsky <leonro@mellanox.com>
To: Bart Van Assche <bvanassche@acm.org>
Cc: Jason Gunthorpe <jgg@ziepe.ca>,
	linux-rdma@vger.kernel.org,
	Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>,
	syzbot+831661966588c802aae9@syzkaller.appspotmail.com
Subject: Re: [PATCH 3/3] ib_srp: Fix a deadlock
Date: Tue, 15 Feb 2022 20:51:38 +0200	[thread overview]
Message-ID: <Ygv2OkMeJYrTwdbi@unreal> (raw)
In-Reply-To: <20220215182650.19839-4-bvanassche@acm.org>

On Tue, Feb 15, 2022 at 10:26:50AM -0800, Bart Van Assche wrote:
> Wait on tl_err_work instead of flushing system_long_wq since flushing
> system_long_wq is deadlock-prone.
> 
> Cc: Tetsuo Handa <penguin-kernel@i-love.sakura.ne.jp>
> Fixes: ef6c49d87c34 ("IB/srp: Eliminate state SRP_TARGET_DEAD")
> Reported-by: syzbot+831661966588c802aae9@syzkaller.appspotmail.com
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>
> ---
>  drivers/infiniband/ulp/srp/ib_srp.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/infiniband/ulp/srp/ib_srp.c b/drivers/infiniband/ulp/srp/ib_srp.c
> index 2db7429b42e1..8e1561a6d325 100644
> --- a/drivers/infiniband/ulp/srp/ib_srp.c
> +++ b/drivers/infiniband/ulp/srp/ib_srp.c
> @@ -4044,12 +4044,10 @@ static void srp_remove_one(struct ib_device *device, void *client_data)
>  		mutex_lock(&host->target_mutex);
>  		list_for_each_entry(target, &host->target_list, list)
>  			srp_queue_remove_work(target);
> +		list_for_each_entry(target, &host->target_list, list)
> +			flush_work(&target->tl_err_work);

Sorry for my silly question, but why do you do flush and not cancel
here? You anyway remove SRP device, so the result of flush is not
really important, am I right?

Thanks

>  		mutex_unlock(&host->target_mutex);
>  
> -		/*
> -		 * Wait for tl_err and target port removal tasks.
> -		 */
> -		flush_workqueue(system_long_wq);
>  		flush_workqueue(srp_remove_wq);
>  
>  		kfree(host);

  reply	other threads:[~2022-02-15 18:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-15 18:26 [PATCH 0/3] Fix a deadlock in the ib_srp driver Bart Van Assche
2022-02-15 18:26 ` [PATCH 1/3] ib_srp: Add more documentation Bart Van Assche
2022-02-15 18:42   ` Leon Romanovsky
2022-02-15 20:34     ` Bart Van Assche
2022-02-16  7:02       ` Leon Romanovsky
2022-02-15 18:26 ` [PATCH 2/3] ib_srp: Protect the target list with a mutex instead of a spinlock Bart Van Assche
2022-02-15 18:44   ` Leon Romanovsky
2022-02-15 20:35     ` Bart Van Assche
2022-02-15 18:26 ` [PATCH 3/3] ib_srp: Fix a deadlock Bart Van Assche
2022-02-15 18:51   ` Leon Romanovsky [this message]
2022-02-15 20:37     ` Bart Van Assche
2022-02-15 20:41       ` Jason Gunthorpe
2022-02-15 20:50         ` Bart Van Assche

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=Ygv2OkMeJYrTwdbi@unreal \
    --to=leonro@mellanox.com \
    --cc=bvanassche@acm.org \
    --cc=jgg@ziepe.ca \
    --cc=linux-rdma@vger.kernel.org \
    --cc=penguin-kernel@i-love.sakura.ne.jp \
    --cc=syzbot+831661966588c802aae9@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