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

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);
 		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);

  parent reply	other threads:[~2022-02-15 18:28 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 ` Bart Van Assche [this message]
2022-02-15 18:51   ` [PATCH 3/3] ib_srp: Fix a deadlock Leon Romanovsky
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=20220215182650.19839-4-bvanassche@acm.org \
    --to=bvanassche@acm.org \
    --cc=jgg@ziepe.ca \
    --cc=leonro@mellanox.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.