From patchwork Wed Oct 10 03:23:08 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Nicholas A. Bellinger" X-Patchwork-Id: 10633899 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1795C13AD for ; Wed, 10 Oct 2018 03:31:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 09DBF29D49 for ; Wed, 10 Oct 2018 03:31:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id F17B829D4B; Wed, 10 Oct 2018 03:31:14 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9645029D49 for ; Wed, 10 Oct 2018 03:31:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726921AbeJJKvS (ORCPT ); Wed, 10 Oct 2018 06:51:18 -0400 Received: from mail.linux-iscsi.org ([67.23.28.174]:53479 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726871AbeJJKvS (ORCPT ); Wed, 10 Oct 2018 06:51:18 -0400 Received: from linux-iscsi.org (localhost [127.0.0.1]) by linux-iscsi.org (Postfix) with ESMTP id DDC1540ABD; Wed, 10 Oct 2018 03:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=linux-iscsi.org; s=default.private; t=1539141795; bh=gTfSdxWSg/YkfEjdAi/RGhIDcrnaz5r Ql5P8awK1xXk=; h=From:To:Cc:Subject:Date:Message-Id; b=X86T1VvCxoMC XVaoeadBwIllh6NFUnXvSnPFAt+ljCQOZm+NQ0lmmNm4TiJwn9g15O+XCyqy/tnWn/E y0kx19O3ZuVeMQp5jAuEzF+Ww2Ja5Xiv6rCtMXn+B2eI6jxUc1xwyABQo7fuUYoNy9C xlGIshNeBuuEmom7kzn4by8eU= From: "Nicholas A. Bellinger" To: target-devel Cc: linux-scsi , lkml , "Martin K. Petersen" , Mike Christie , Hannes Reinecke , Christoph Hellwig , Sagi Grimberg , "Bryant G. Ly" , "Peter Zijlstra (Intel)" , Nicholas Bellinger Subject: [PATCH 0/2] target: Fix v4.19-rc active I/O shutdown deadlock Date: Wed, 10 Oct 2018 03:23:08 +0000 Message-Id: <1539141790-13557-1-git-send-email-nab@linux-iscsi.org> X-Mailer: git-send-email 1.7.2.5 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Nicholas Bellinger Hi MNC, MKP & Co, While testing v4.19-rc recently with simple backend I/O error injection (via delayed BIO completion), I was able to trigger an end-less loop deadlock with recent changes in commit 00d909a107: Author: Bart Van Assche Date: Fri Jun 22 14:52:53 2018 -0700 scsi: target: Make the session shutdown code also wait for commands that are being aborted It comes down to an incorrect assumption wrt signals during session shutdown plus active I/O quiesce, which triggers an endless loop immediately during session shutdown as se_session->sess_list_wq waits for outstanding backend I/O to complete. The easiest reproduction is with iser-target or simulation with plain old iscsi-target/TCP ports. However, any fabric driver who triggers session shutdown from user-space processes with signals pending can easily trigger it and bring down the machine. The fix is simple, but requires a new wait_event_lock_irq_timeout() macro to allow TASK_UNINTERRUPTIBLE to be set in order to work as expected for all fabric driver session shutdown cases. So short of reverting commit 00d909a107 now for v4.19, this is going to be the best option. Please review for v4.19, or v4.20-rc1 with stable CC's for both. Thank you. Nicholas Bellinger (2): sched/wait: Add wait_event_lock_irq_timeout for TASK_UNINTERRUPTIBLE usage target: Fix target_wait_for_sess_cmds breakage with active signals drivers/target/target_core_transport.c | 4 ++-- include/linux/wait.h | 20 +++++++++++++++----- 2 files changed, 17 insertions(+), 7 deletions(-) Signed-off-by: Nicholas Bellinger