Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp392676imm; Tue, 9 Oct 2018 20:35:37 -0700 (PDT) X-Google-Smtp-Source: ACcGV6127jsUgWxWy0++crPOcJTRpkTUyRu8qsiph3+WrtvOZKfmRDFBTYSzArJAjsxxK+/P9TcC X-Received: by 2002:a63:6111:: with SMTP id v17-v6mr27771538pgb.226.1539142537378; Tue, 09 Oct 2018 20:35:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539142537; cv=none; d=google.com; s=arc-20160816; b=kS8r8dpI5waMQfMD/xPHYIqflcJ7rF+JtGc1b+2lK6rU1f5hufskkyheAK9zZ/bRCd 0R4PjQF8zLWP4/s4t4x5jCjhDTzLpZPSx7eptTja8svwOVs0KICVESX3hbteWbFry/Hb 8dNxHiPSzbQCacYKG+cS4C6CXHs+NThZr+pcsHJ8pus+dqPt2nM4Dn7mdh3lhwxclRw4 +wtSks7ntWWRizR/+mL8hzipTguRl0X0H84/W2cPtdtucXkHS7Mlt21iL3XbAr7OwybT 4KHNCdip8ikhIE+3jSfgnvi4QwBzNZtymSKzM9MaTRNcCrDYHJF1dgJg7l1e9VVE4fb3 3T3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=urmm+odP9JsvAXnL106hnOnipv6Q+r8XxLbRDCWjHSU=; b=EBHmOHWzVaG/2Nw35KrfpP1ICxsv5YISwyThQVM3lqXQL4IzE53MUt8LFY++EWxBDj YbREyZYHsxBvEJ7CPwbH7UQp225ahMm6vslQ+w1Sm09W7iT1xN1E5MXFlhl7+TDxxLVg bmUKCgU4JpQVgfNsmI+M2zt2HfKnt/ObSNGPOL9hHdLSqDk/Pv0R5KoyfbFRbZcqoNky ssqcldGFVJRkSwd9fc+wxSqw2qU6siMuTynZ8dZrawC0GXfMwGGgP2t/Ft09Kz35XTb0 9mpkiujRo6ppVLLd4su8bTMZV6+WxagQ5GAk9ZJcS0yYihE0G5k1oG1AqitJy7TI7GuA d6FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@linux-iscsi.org header.s=default.private header.b=Bg+HkRiN; 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 v191-v6si21437936pgd.157.2018.10.09.20.35.22; Tue, 09 Oct 2018 20:35:37 -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; dkim=fail header.i=@linux-iscsi.org header.s=default.private header.b=Bg+HkRiN; 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 S1727261AbeJJKv2 (ORCPT + 99 others); Wed, 10 Oct 2018 06:51:28 -0400 Received: from mail.linux-iscsi.org ([67.23.28.174]:53475 "EHLO linux-iscsi.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726530AbeJJKvS (ORCPT ); Wed, 10 Oct 2018 06:51:18 -0400 X-Greylist: delayed 484 seconds by postgrey-1.27 at vger.kernel.org; Wed, 10 Oct 2018 06:51:17 EDT Received: from linux-iscsi.org (localhost [127.0.0.1]) by linux-iscsi.org (Postfix) with ESMTP id C213840AC0; Wed, 10 Oct 2018 03:23:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=linux-iscsi.org; s=default.private; t=1539141798; bh=9KFzkNgbj5gmfIPZzxxtkKAmcouZOh4 GheAoMqHu/Uw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To: References; b=Bg+HkRiNy4ngWO2JVVH+pElIj1lZ8KZ2CCBEH4VeB/lg/6UL66U3 tJufVDYanP90/mcGXJgCQ3gKBNLs0pl+taJ5m/sOsljKGSBT/lGm6a14FyXduU2jgIB MP2kASpLUxon3Coi7eQVsxvXzRdTjKOenB71nOrT1cVzC2G2oiXE= 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 , Bart Van Assche Subject: [PATCH 1/2] sched/wait: Add wait_event_lock_irq_timeout for TASK_UNINTERRUPTIBLE usage Date: Wed, 10 Oct 2018 03:23:09 +0000 Message-Id: <1539141790-13557-2-git-send-email-nab@linux-iscsi.org> X-Mailer: git-send-email 1.7.2.5 In-Reply-To: <1539141790-13557-1-git-send-email-nab@linux-iscsi.org> References: <1539141790-13557-1-git-send-email-nab@linux-iscsi.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Nicholas Bellinger Short of reverting commit 00d909a107 for v4.19, target-core needs a wait_event_t marco can be executed using TASK_UNINTERRUPTIBLE to function correctly with existing fabric drivers that expect to run with signals pending during session shutdown and active se_cmd I/O quiesce. The most notable is iscsi-target/iser-target, while ibmvscsi_tgt invokes session shutdown logic from userspace via configfs attribute that could also potentially have signals pending. So go ahead and introduce wait_event_lock_irq_timeout() to achieve this, and update + rename __wait_event_lock_irq_timeout() to make it accept 'state' as a parameter. Fixes: 00d909a107 ("scsi: target: Make the session shutdown code also wait for commands that are being aborted") Cc: Bart Van Assche Cc: Mike Christie Cc: Hannes Reinecke Cc: Christoph Hellwig Cc: Sagi Grimberg Cc: Bryant G. Ly Cc: Peter Zijlstra (Intel) Tested-by: Nicholas Bellinger Signed-off-by: Nicholas Bellinger --- include/linux/wait.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/include/linux/wait.h b/include/linux/wait.h index d9f131e..ed7c122 100644 --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -1052,10 +1052,9 @@ void __wake_up_locked_key_bookmark(struct wait_queue_head *wq_head, __ret; \ }) -#define __wait_event_interruptible_lock_irq_timeout(wq_head, condition, \ - lock, timeout) \ +#define __wait_event_lock_irq_timeout(wq_head, condition, lock, timeout, state) \ ___wait_event(wq_head, ___wait_cond_timeout(condition), \ - TASK_INTERRUPTIBLE, 0, timeout, \ + state, 0, timeout, \ spin_unlock_irq(&lock); \ __ret = schedule_timeout(__ret); \ spin_lock_irq(&lock)); @@ -1089,8 +1088,19 @@ void __wake_up_locked_key_bookmark(struct wait_queue_head *wq_head, ({ \ long __ret = timeout; \ if (!___wait_cond_timeout(condition)) \ - __ret = __wait_event_interruptible_lock_irq_timeout( \ - wq_head, condition, lock, timeout); \ + __ret = __wait_event_lock_irq_timeout( \ + wq_head, condition, lock, timeout, \ + TASK_INTERRUPTIBLE); \ + __ret; \ +}) + +#define wait_event_lock_irq_timeout(wq_head, condition, lock, timeout) \ +({ \ + long __ret = timeout; \ + if (!___wait_cond_timeout(condition)) \ + __ret = __wait_event_lock_irq_timeout( \ + wq_head, condition, lock, timeout, \ + TASK_UNINTERRUPTIBLE); \ __ret; \ }) -- 1.9.1