All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: do not use interruptible wait anywhere
@ 2018-04-12 16:23 Alan Jenkins
  2018-04-12 17:51   ` Bart Van Assche
  0 siblings, 1 reply; 18+ messages in thread
From: Alan Jenkins @ 2018-04-12 16:23 UTC (permalink / raw)
  To: Jens Axboe, linux-block; +Cc: linux-kernel, Alan Jenkins, stable

When blk_queue_enter() waits for a queue to unfreeze, or unset the
PREEMPT_ONLY flag, do not allow it to be interrupted by a signal.

The PREEMPT_ONLY flag was introduced later in commit 3a0a529971ec
("block, scsi: Make SCSI quiesce and resume work reliably").  Note the SCSI
device is resumed asynchronously, i.e. after un-freezing userspace tasks.

So that commit exposed the bug as a regression in v4.15.  A mysterious
SIGBUS (or -EIO) sometimes happened during the time the device was being
resumed.  Most frequently, there was no kernel log message, and we saw Xorg
or Xwayland killed by SIGBUS.[1]

[1] E.g. https://bugzilla.redhat.com/show_bug.cgi?id=1553979

Without this fix, I get an IO error in this test:

# dd if=/dev/sda of=/dev/null iflag=direct & \
  while killall -SIGUSR1 dd; do sleep 0.1; done & \
  echo mem > /sys/power/state ; \
  sleep 5; killall dd  # stop after 5 seconds

The interruptible wait was added to blk_queue_enter in
commit 3ef28e83ab15 ("block: generic request_queue reference counting").
Before then, the interruptible wait was only in blk-mq, but I don't think
it could ever have been correct.

Cc: stable@vger.kernel.org
Signed-off-by: Alan Jenkins <alan.christopher.jenkins@gmail.com>
---
 block/blk-core.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/block/blk-core.c b/block/blk-core.c
index abcb8684ba67..5a6d20069364 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -915,7 +915,6 @@ int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags)
 
 	while (true) {
 		bool success = false;
-		int ret;
 
 		rcu_read_lock();
 		if (percpu_ref_tryget_live(&q->q_usage_counter)) {
@@ -947,14 +946,12 @@ int blk_queue_enter(struct request_queue *q, blk_mq_req_flags_t flags)
 		 */
 		smp_rmb();
 
-		ret = wait_event_interruptible(q->mq_freeze_wq,
+		wait_event(q->mq_freeze_wq,
 				(atomic_read(&q->mq_freeze_depth) == 0 &&
 				 (preempt || !blk_queue_preempt_only(q))) ||
 				blk_queue_dying(q));
 		if (blk_queue_dying(q))
 			return -ENODEV;
-		if (ret)
-			return ret;
 	}
 }
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2018-04-25  8:46 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-12 16:23 [PATCH] block: do not use interruptible wait anywhere Alan Jenkins
2018-04-12 17:51 ` Bart Van Assche
2018-04-12 17:51   ` Bart Van Assche
2018-04-12 18:11   ` [PATCH v2] " Alan Jenkins
2018-04-13  8:31     ` Johannes Thumshirn
2018-04-14 19:46       ` blktest for " Alan Jenkins
2018-04-14 19:52         ` Jens Axboe
2018-04-15 12:15           ` Alan Jenkins
2018-04-16 21:23             ` [PATCH] blktests: regression test "block: do not use interruptible wait anywhere" Alan Jenkins
2018-04-16 21:52               ` Alan Jenkins
2018-04-17  7:21                 ` Johannes Thumshirn
2018-04-17 15:55                   ` Alan Jenkins
2018-04-17 15:10                     ` [PATCH v3] " Alan Jenkins
2018-04-17 15:21                       ` [PATCH v4] " Alan Jenkins
2018-04-24 22:46                         ` Omar Sandoval
2018-04-25  8:46                           ` Alan Jenkins
2018-04-18  7:25                     ` [PATCH] " Johannes Thumshirn
2018-04-14 19:54     ` [PATCH v2] block: do not use interruptible wait anywhere Jens Axboe

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.