Received: by 10.192.165.148 with SMTP id m20csp4149243imm; Mon, 30 Apr 2018 12:41:31 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrVriEPsUquieGjQKU5eofqYLFNY+KF52GUbWNFxY42GwC1e9Ze0K7dONUHp+9axIOVoqPi X-Received: by 2002:a17:902:8c95:: with SMTP id t21-v6mr9639655plo.306.1525117291344; Mon, 30 Apr 2018 12:41:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525117291; cv=none; d=google.com; s=arc-20160816; b=MHH4ClSL2/iLlCtPeQxAOfKjtKfOcqeqzRnqiijF69vt+GLuv1CvbA6mzMujpvaL/g mae/VU/mxyCMVSxJVNwYOjnaXS0SVzNdqFgLgQ9YiwLLC7OLQIyFtUuLn6zZmjTiuO2X UAQ74Pk4nbGGKMO/xo+9eU/v7u08fJD3+tLubyepQvVoXDHYbywgeWGishTJmLuXLaaO oo9TFP57l0pSLDQtZbmtKiewNRmAighqWYyTI+HwR8xsTF5bWJfd6vt78LkfuT2Med5m zTCqAF4U+Gw1TmmzWzGbitHopDMX1QlmKiZU55Jj5lbRXPvo/jQadHXC3BiQF+x1EkcJ trVA== 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:dmarc-filter :arc-authentication-results; bh=tIOyW98+GmdJGKInuP4LepZKGBF3e4dMKWM6StN7uQQ=; b=tiAtpQsj9Amf1TO7uy9N6O9Sz440WQFEUd041eNRTb2E9GfIAvp36ht9C6QESZI3Jh nmowjcNJ/btCeiEqid73JQfeT3nbiAnjnHB3uagllhU4+ACZEeOHyVCKiEXO1o1yz4hg CF5Jhf7i9E0nc/W6k9nHMyJvbk9NLRpUgeDEljJDTR57adL5Q3276EfsIlXjneAodnnl rDzNlsd0jQAxFr2LJw6Iv6RwMqy+nG0JNBi3XPysIv0nI+sch0Nakt2K57HOfHwOqHsp L6+cqkUo5pWL9ZHgomEF64cxwnPmpVdxLFRHcbMtA2fHLT6GatDlYv/vPOAQMCLh1kQQ hCMQ== 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 1-v6si7936473plv.217.2018.04.30.12.41.17; Mon, 30 Apr 2018 12:41:31 -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 S932316AbeD3T2e (ORCPT + 99 others); Mon, 30 Apr 2018 15:28:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:36214 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932307AbeD3T22 (ORCPT ); Mon, 30 Apr 2018 15:28:28 -0400 Received: from localhost (unknown [104.132.1.102]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2886822DC1; Mon, 30 Apr 2018 19:28:28 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2886822DC1 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=linuxfoundation.org Authentication-Results: mail.kernel.org; spf=fail smtp.mailfrom=gregkh@linuxfoundation.org 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 Subject: [PATCH 4.16 065/113] block: do not use interruptible wait anywhere Date: Mon, 30 Apr 2018 12:24:36 -0700 Message-Id: <20180430184017.968356287@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180430184015.043892819@linuxfoundation.org> References: <20180430184015.043892819@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.16-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: Greg Kroah-Hartman --- block/blk-core.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) --- a/block/blk-core.c +++ b/block/blk-core.c @@ -829,7 +829,6 @@ int blk_queue_enter(struct request_queue while (true) { bool success = false; - int ret; rcu_read_lock(); if (percpu_ref_tryget_live(&q->q_usage_counter)) { @@ -861,14 +860,12 @@ int blk_queue_enter(struct request_queue */ smp_rmb(); - ret = wait_event_interruptible(q->mq_freeze_wq, - (atomic_read(&q->mq_freeze_depth) == 0 && - (preempt || !blk_queue_preempt_only(q))) || - blk_queue_dying(q)); + 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; } }