Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3474814imu; Sun, 11 Nov 2018 15:57:39 -0800 (PST) X-Google-Smtp-Source: AJdET5cUnHW8aeIYuxGz7OAOi+dTm6P4yCyGiswRBz/XxBjL6tqivThXsoay3YZCbvmFux8Od9lS X-Received: by 2002:aa7:80ce:: with SMTP id a14-v6mr9747453pfn.86.1541980658956; Sun, 11 Nov 2018 15:57:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541980658; cv=none; d=google.com; s=arc-20160816; b=jrRogyTLpiuXqy4Fo36rwC3MsuliFK+8uuDeSRR/hSFPfbZ2WOW+GcnzjquGixZs+M fuQHNst2m9PyINmCAEOMtUKtzbGqyKjvkD4zDhr7qFq5VSGe61vl0/53mDn7qrcBWCOI 5w70oD4hmzvSrhBWUDIAKb8jnZghvqY3cFaMy6TiN2M4so6bBGoBLpIUVS5IYtc4ZvmY 3FYnhZyI93UonuE464aUG3dw8NtPQ/YMimE/XFvGPGWfAG7xvbIqM7O6wWebPGfE4Of0 Y92STxHa8cSow4V76nFdVvy8o+lyuf9B5Xg5hkM8oOMZHN1Vtwny6UAvTqYIIOf/wMxp k7Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=DfLXfKRGFpEm7sYPcP6gewitRTocrzQgcmTpaYl9rdQ=; b=pl0We+EZna2QbKiRobEhYUbVmkz7GnLqGQ1iapN7ZoRoo1HNQ78i+aMTBxknCSYK8v 1IgvlwsgDmQLC7qkmbi0gItPhH/JAB80h1Fow2Jt9Y3KE9eBiwuashhdjHKmEmEr+ZVA My3tArlMqhQFALPif5ujGUljhZIVdKN/TB7yRTM4aMq8UDm/+6hIOg4PlE+MzcizO4TY 7ykVhHHyoQGbExhMazOWDqThb43y1EUAfCfZjoFCdEZFrUe90yzx4bT5oVmHQUIHocKe XYGIAr2Y+ahIBOj8k9YQ6R45mfa6OpdLF1UMi6Rz5/vR0kgDQ0J548fbCtn2uqdQNY5s R+Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kqE4zpmT; 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 r23si15908811pgu.359.2018.11.11.15.57.24; Sun, 11 Nov 2018 15:57:38 -0800 (PST) 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=pass header.i=@kernel.org header.s=default header.b=kqE4zpmT; 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 S1732569AbeKLISN (ORCPT + 99 others); Mon, 12 Nov 2018 03:18:13 -0500 Received: from mail.kernel.org ([198.145.29.99]:35400 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732500AbeKLISM (ORCPT ); Mon, 12 Nov 2018 03:18:12 -0500 Received: from localhost (unknown [206.108.79.134]) (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 05AAE22419; Sun, 11 Nov 2018 22:28:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541975297; bh=74JmcqTBfH/o9uNtqdzb91UOrlidlCTDzDsWPsKAICM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kqE4zpmTHTqK8LRgXBscWz8ltIZ9KeIO2ZxRpS1/EnptAtu2nSve8uOrDK5W6xr+f GChhB8MkL5UYM4HcjTlEZ42GHq3mJ9OYZM4M4o1zkFUUO7TbVJWyiKsVKZtlFPMRB+ Wumpc9L2k7kmtZWI7jwWWQMb1n8BYAFMccEhDL78= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bart Van Assche , Mike Christie , Hannes Reinecke , Christoph Hellwig , Sagi Grimberg , "Bryant G. Ly" , "Peter Zijlstra (Intel)" , Nicholas Bellinger , "Bryant G. Ly" , "Martin K. Petersen" Subject: [PATCH 4.19 215/361] scsi: sched/wait: Add wait_event_lock_irq_timeout for TASK_UNINTERRUPTIBLE usage Date: Sun, 11 Nov 2018 14:19:22 -0800 Message-Id: <20181111221650.055492978@linuxfoundation.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181111221619.915519183@linuxfoundation.org> References: <20181111221619.915519183@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nicholas Bellinger commit 25ab0bc334b43bbbe4eabc255006ce42a9424da2 upstream. Short of reverting commit 00d909a10710 ("scsi: target: Make the session shutdown code also wait for commands that are being aborted") for v4.19, target-core needs a wait_event_t macro 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: 00d909a10710 ("scsi: target: Make the session shutdown code also wait for commands that are being aborted") Cc: # v4.19+ 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 Reviewed-by: Bryant G. Ly Acked-by: Peter Zijlstra (Intel) Reviewed-by: Bart Van Assche Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- include/linux/wait.h | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) --- a/include/linux/wait.h +++ b/include/linux/wait.h @@ -1052,10 +1052,9 @@ do { \ __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 @@ do { \ ({ \ 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; \ })