All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ming Lei <ming.lei@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org,
	Stefano Garzarella <sgarzare@redhat.com>,
	German Maglione <gmaglione@redhat.com>,
	Ming Lei <ming.lei@redhat.com>
Subject: [PATCH V2 2/3] ublk: fail to recover device if queue setup is interrupted
Date: Wed, 26 Jul 2023 22:45:01 +0800	[thread overview]
Message-ID: <20230726144502.566785-3-ming.lei@redhat.com> (raw)
In-Reply-To: <20230726144502.566785-1-ming.lei@redhat.com>

In ublk_ctrl_end_recovery(), if wait_for_completion_interruptible() is
interrupted by signal, queues aren't setup successfully yet, so we
have to fail UBLK_CMD_END_USER_RECOVERY, otherwise kernel oops can be
triggered.

Fixes: c732a852b419 ("ublk_drv: add START_USER_RECOVERY and END_USER_RECOVERY support")
Reported-by: Stefano Garzarella <sgarzare@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
---
 drivers/block/ublk_drv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 7938221f4f7e..9fcba3834e8d 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -2324,7 +2324,9 @@ static int ublk_ctrl_end_recovery(struct ublk_device *ub,
 	pr_devel("%s: Waiting for new ubq_daemons(nr: %d) are ready, dev id %d...\n",
 			__func__, ub->dev_info.nr_hw_queues, header->dev_id);
 	/* wait until new ubq_daemon sending all FETCH_REQ */
-	wait_for_completion_interruptible(&ub->completion);
+	if (wait_for_completion_interruptible(&ub->completion))
+		return -EINTR;
+
 	pr_devel("%s: All new ubq_daemons(nr: %d) are ready, dev id %d\n",
 			__func__, ub->dev_info.nr_hw_queues, header->dev_id);
 
-- 
2.40.1


  parent reply	other threads:[~2023-07-26 14:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-26 14:44 [PATCH V2 0/3] ublk: fail to start/recover/del device if interrupted by signal Ming Lei
2023-07-26 14:45 ` [PATCH V2 1/3] ublk: fail to start device if queue setup is interrupted Ming Lei
2023-07-26 14:45 ` Ming Lei [this message]
2023-07-27 13:04   ` [PATCH V2 2/3] ublk: fail to recover " Stefano Garzarella
2023-07-26 14:45 ` [PATCH V2 3/3] ublk: return -EINTR if breaking from waiting for existed users in DEL_DEV Ming Lei
2023-07-27 13:05   ` Stefano Garzarella
2023-07-27 13:17 ` [PATCH V2 0/3] ublk: fail to start/recover/del device if interrupted by signal Jens Axboe

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=20230726144502.566785-3-ming.lei@redhat.com \
    --to=ming.lei@redhat.com \
    --cc=axboe@kernel.dk \
    --cc=gmaglione@redhat.com \
    --cc=linux-block@vger.kernel.org \
    --cc=sgarzare@redhat.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.