Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp5764375imm; Mon, 23 Jul 2018 05:48:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpe7PplB1G3aO6spcqvB9j9QDEzvaEdIB7kf8MjtilTboVkRc3cd5yfxnQVWyPylyzs0/8ys X-Received: by 2002:a63:8f53:: with SMTP id r19-v6mr11896129pgn.17.1532350094814; Mon, 23 Jul 2018 05:48:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532350094; cv=none; d=google.com; s=arc-20160816; b=cKNuPrdfT6EaOE59sQY5Ys3fpBqS7ufdphH177s7IQX5uCqv61df97ImoDjpAxNhhE AvmqhoCRaEmvi7ewDyhgOayn9OtxaCxfNsBmNgLmkOoOiCDizMOZvx4AG+piPaXkTBEP 6pq/W4m4KNEakxD/eIR8VzzEI6JGMx6FK96JDYpsRlogtp5sOzbKWIdeaKXxh/3Kt1hS tFqercc5RFY/e4lWtp5snoAV76dB5ZFIn+NclruK4wbeBY8TT+6SEoQwgZUYmUgIVawp b3UWAmeHWC6tUjqLGlOAs2XQ0loaKaKqEN8BR7YOGInyoNSry/1eritJLGJHJTTJvjLN n2tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=/TK8UjOd8UzBy5ZQ30O9/1tFY/AgEe0mS8r65Y8WtIA=; b=KRXRUbtXgSWIR/UjRXynmrGP3MCX+Xqv1SxE6udhPL8iRdU7ssKrD/Uj9ihmecjNbf gKOprFD/ddCEbXFfE/v8TIQXpKnz9qI6pK/D8Mz1vGgClg/X3Ry7Sn22HR5kh5ANTIpw ACt6EWyTmjHSk1DJXQsYvC8xQR44O/1i8tepVDz5DsIXvQqCfVjY0l3FbfytaZ1DD0nm lknFjiSw3Aumpdq3Xuo0PPLtO7UO5xztDLEIqFFvE0fzfdCkY4yIlzF5+oVwbcOSW0D6 ASkHxC0T4JRPy5CpxAPGxnQyybiNPt8GtR+wNJLh2qxULSj2XMtYzxDT0A/xV7POhuNR e5Tg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4-v6si8008616pll.156.2018.07.23.05.48.00; Mon, 23 Jul 2018 05:48:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389721AbeGWNsP (ORCPT + 99 others); Mon, 23 Jul 2018 09:48:15 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:51892 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388499AbeGWNsP (ORCPT ); Mon, 23 Jul 2018 09:48:15 -0400 Received: from localhost (LFbn-1-12238-233.w90-92.abo.wanadoo.fr [90.92.53.233]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 9ED71BDB; Mon, 23 Jul 2018 12:47:10 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Alan Jenkins , Jens Axboe , Sudip Mukherjee Subject: [PATCH 4.4 100/107] block: do not use interruptible wait anywhere Date: Mon, 23 Jul 2018 14:42:34 +0200 Message-Id: <20180723122418.519361003@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180723122413.003644357@linuxfoundation.org> References: <20180723122413.003644357@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alan Jenkins commit 1dc3039bc87ae7d19a990c3ee71cfd8a9068f428 upstream. 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. Reviewed-by: Bart Van Assche Cc: stable@vger.kernel.org Signed-off-by: Alan Jenkins Signed-off-by: Jens Axboe Signed-off-by: Sudip Mukherjee Signed-off-by: Greg Kroah-Hartman --- block/blk-core.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) --- a/block/blk-core.c +++ b/block/blk-core.c @@ -651,21 +651,17 @@ EXPORT_SYMBOL(blk_alloc_queue); int blk_queue_enter(struct request_queue *q, gfp_t gfp) { while (true) { - int ret; - if (percpu_ref_tryget_live(&q->q_usage_counter)) return 0; if (!gfpflags_allow_blocking(gfp)) return -EBUSY; - ret = wait_event_interruptible(q->mq_freeze_wq, - !atomic_read(&q->mq_freeze_depth) || - blk_queue_dying(q)); + wait_event(q->mq_freeze_wq, + !atomic_read(&q->mq_freeze_depth) || + blk_queue_dying(q)); if (blk_queue_dying(q)) return -ENODEV; - if (ret) - return ret; } }