From patchwork Wed Jun 7 18:22:42 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13271134 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2DA33C7EE2E for ; Wed, 7 Jun 2023 18:24:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231126AbjFGSYy (ORCPT ); Wed, 7 Jun 2023 14:24:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231423AbjFGSYm (ORCPT ); Wed, 7 Jun 2023 14:24:42 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9AA3826BB; Wed, 7 Jun 2023 11:24:20 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id A10E21FDB6; Wed, 7 Jun 2023 18:23:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1686162195; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dcQe94NHWKwEfD3MI7AnQAtuXjeqyhqnM1uaeyFHWSs=; b=GAALNW3/t1DsjWjR2gP0xLezPK6/VzFBX7uwANlzX4F+J/q/AfeRr9VrOurbnrR5+4dRv8 FmFRAFebCO28bQb9SdwuLMQfz7QKfwQHHGqv4xOMx37QBBzTjJhNPM38kmQG2rktzC4SC3 dzEAK9Y+04EOjWrk6ZnzGOHZnYypTFM= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 061D71346D; Wed, 7 Jun 2023 18:23:14 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id INRYOhLLgGRzBQAAMHmgww (envelope-from ); Wed, 07 Jun 2023 18:23:14 +0000 From: mwilck@suse.com To: "Martin K. Petersen" , Christoph Hellwig , Ming Lei , Bart Van Assche Cc: James Bottomley , linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, Hannes Reinecke , Bart Van Assche Subject: [PATCH v3 1/8] bsg: increase number of devices Date: Wed, 7 Jun 2023 20:22:42 +0200 Message-Id: <20230607182249.22623-2-mwilck@suse.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230607182249.22623-1-mwilck@suse.com> References: <20230607182249.22623-1-mwilck@suse.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Hannes Reinecke Larger setups may need to allocate more than 32k bsg devices, so increase the number of devices to the full range of minor device numbers. Signed-off-by: Hannes Reinecke Signed-off-by: Martin Wilck Reviewed-by: Christoph Hellwig Reviewed-by: Ming Lei Reviewed-by: Bart Van Assche --- block/bsg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/block/bsg.c b/block/bsg.c index 7eca43f33d7f..c53f24243bf2 100644 --- a/block/bsg.c +++ b/block/bsg.c @@ -36,7 +36,7 @@ static inline struct bsg_device *to_bsg_device(struct inode *inode) } #define BSG_DEFAULT_CMDS 64 -#define BSG_MAX_DEVS 32768 +#define BSG_MAX_DEVS (1 << MINORBITS) static DEFINE_IDA(bsg_minor_ida); static struct class *bsg_class; From patchwork Wed Jun 7 18:22:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13271129 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C2D33C7EE25 for ; Wed, 7 Jun 2023 18:23:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229944AbjFGSXt (ORCPT ); Wed, 7 Jun 2023 14:23:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230125AbjFGSXo (ORCPT ); Wed, 7 Jun 2023 14:23:44 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6A5662708; Wed, 7 Jun 2023 11:23:20 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7B94C21A1B; Wed, 7 Jun 2023 18:23:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1686162196; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Md2lKFbYYlIFRimhTAFovw3H98C3UoSpAEfzkvqw8/k=; b=HpDVVkf16prTrt7Yyjpec0Ir5S09X7dSv6oih5WjTVjM+BmQ1JtcywYVxZKlihdsSHiR/s ha7Vu3fRAk5FNedmIzZ5BNq3Z/H2sEwdAANMu5VAaGjH2J33l30LC3uS7mJhxEMaFej7vY yP+PdbfT6mPv2tf+9vq28/hjdJJY64Y= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id C002B1346D; Wed, 7 Jun 2023 18:23:15 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id GCkvKxPLgGRzBQAAMHmgww (envelope-from ); Wed, 07 Jun 2023 18:23:15 +0000 From: mwilck@suse.com To: "Martin K. Petersen" , Christoph Hellwig , Ming Lei , Bart Van Assche Cc: James Bottomley , linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, Hannes Reinecke , Douglas Gilbert , Bart Van Assche Subject: [PATCH v3 2/8] scsi: sg: increase number of devices Date: Wed, 7 Jun 2023 20:22:43 +0200 Message-Id: <20230607182249.22623-3-mwilck@suse.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230607182249.22623-1-mwilck@suse.com> References: <20230607182249.22623-1-mwilck@suse.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Hannes Reinecke Larger setups may need to allocate more than 32k sg devices, so increase the number of devices to the full range of minor device numbers. Signed-off-by: Hannes Reinecke Signed-off-by: Martin Wilck Acked-by: Douglas Gilbert Reviewed-by: Christoph Hellwig Reviewed-by: Ming Lei Reviewed-by: Bart Van Assche --- drivers/scsi/sg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c index 037f8c98a6d3..6c04cf941dac 100644 --- a/drivers/scsi/sg.c +++ b/drivers/scsi/sg.c @@ -71,7 +71,7 @@ static int sg_proc_init(void); #define SG_ALLOW_DIO_DEF 0 -#define SG_MAX_DEVS 32768 +#define SG_MAX_DEVS (1 << MINORBITS) /* SG_MAX_CDB_SIZE should be 260 (spc4r37 section 3.1.30) however the type * of sg_io_hdr::cmd_len can only represent 255. All SCSI commands greater From patchwork Wed Jun 7 18:22:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13271133 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 03FCCC7EE25 for ; Wed, 7 Jun 2023 18:24:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230143AbjFGSYg (ORCPT ); Wed, 7 Jun 2023 14:24:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40840 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230499AbjFGSY3 (ORCPT ); Wed, 7 Jun 2023 14:24:29 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3ECA21FDD; Wed, 7 Jun 2023 11:24:07 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4FA0A1FDBA; Wed, 7 Jun 2023 18:23:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1686162197; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KG+rY1hnEg+6A6X4S7J3tjDuxiHe+WX4EcSLzv2Lmg0=; b=Dqf3quXgB56w1Ml/Urfo4iBAG45SYcHd5hQHspPy/HQgIgUX0d9gs3Wrh2Niez2Z0vOHRc MztnzCxQ/TH91gszTjHnS/HCqqobaKu2qvl73kEVGSxfHbCv8RfLpHfXXFzzVSwkpXaF68 lIafcFC3iIqZ42FqpHqzGXDLiqGmazI= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 984D01346D; Wed, 7 Jun 2023 18:23:16 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id UAlTIRTLgGRzBQAAMHmgww (envelope-from ); Wed, 07 Jun 2023 18:23:16 +0000 From: mwilck@suse.com To: "Martin K. Petersen" , Christoph Hellwig , Ming Lei , Bart Van Assche Cc: James Bottomley , linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, Hannes Reinecke , Martin Wilck Subject: [PATCH v3 3/8] scsi: merge scsi_internal_device_block() and device_block() Date: Wed, 7 Jun 2023 20:22:44 +0200 Message-Id: <20230607182249.22623-4-mwilck@suse.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230607182249.22623-1-mwilck@suse.com> References: <20230607182249.22623-1-mwilck@suse.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Martin Wilck scsi_internal_device_block() is only called from device_block(). Merge the two functions, and call the result scsi_device_block(), as the name device_block() is confusingly generic. Signed-off-by: Martin Wilck Reviewed-by: Bart Van Assche Reviewed-by: Christoph Hellwig --- drivers/scsi/scsi_lib.c | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 25489fbd94c6..ce5788643011 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2776,13 +2776,12 @@ int scsi_internal_device_block_nowait(struct scsi_device *sdev) EXPORT_SYMBOL_GPL(scsi_internal_device_block_nowait); /** - * scsi_internal_device_block - try to transition to the SDEV_BLOCK state + * scsi_device_block - try to transition to the SDEV_BLOCK state * @sdev: device to block + * @data: dummy argument, ignored * * Pause SCSI command processing on the specified device and wait until all - * ongoing scsi_request_fn() / scsi_queue_rq() calls have finished. May sleep. - * - * Returns zero if successful or a negative error code upon failure. + * ongoing scsi_queue_rq() calls have finished. May sleep. * * Note: * This routine transitions the device to the SDEV_BLOCK state (which must be @@ -2790,7 +2789,7 @@ EXPORT_SYMBOL_GPL(scsi_internal_device_block_nowait); * is paused until the device leaves the SDEV_BLOCK state. See also * scsi_internal_device_unblock(). */ -static int scsi_internal_device_block(struct scsi_device *sdev) +static void scsi_device_block(struct scsi_device *sdev, void *data) { int err; @@ -2800,7 +2799,8 @@ static int scsi_internal_device_block(struct scsi_device *sdev) scsi_stop_queue(sdev, false); mutex_unlock(&sdev->state_mutex); - return err; + WARN_ONCE(err, "__scsi_internal_device_block_nowait(%s) failed: err = %d\n", + dev_name(&sdev->sdev_gendev), err); } /** @@ -2883,23 +2883,12 @@ static int scsi_internal_device_unblock(struct scsi_device *sdev, return ret; } -static void -device_block(struct scsi_device *sdev, void *data) -{ - int ret; - - ret = scsi_internal_device_block(sdev); - - WARN_ONCE(ret, "scsi_internal_device_block(%s) failed: ret = %d\n", - dev_name(&sdev->sdev_gendev), ret); -} - static int target_block(struct device *dev, void *data) { if (scsi_is_target_device(dev)) starget_for_each_device(to_scsi_target(dev), NULL, - device_block); + scsi_device_block); return 0; } @@ -2908,7 +2897,7 @@ scsi_target_block(struct device *dev) { if (scsi_is_target_device(dev)) starget_for_each_device(to_scsi_target(dev), NULL, - device_block); + scsi_device_block); else device_for_each_child(dev, NULL, target_block); } From patchwork Wed Jun 7 18:22:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13271130 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE2EFC7EE2E for ; Wed, 7 Jun 2023 18:24:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229893AbjFGSYL (ORCPT ); Wed, 7 Jun 2023 14:24:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbjFGSXr (ORCPT ); Wed, 7 Jun 2023 14:23:47 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 314E62711; Wed, 7 Jun 2023 11:23:22 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 0E6CD21A1E; Wed, 7 Jun 2023 18:23:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1686162198; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gcWJ/FMqmwc6clgHxsDNCZDPW0c5pmCkA5iwQiwV4Gc=; b=AX65f+3u4vUcDLJUTGCGeL84uf9W4yip8/BT2RzeMcvJ9tp0yncwk7ItUwFeO9RaIHAop0 jRU6yWeUAIS6mWfcRV79RgAFqJ21naF2m9bJSxZe0CMNwRYh34R9Gh72WN3psBG3dw7yGI n1DasKknx2GwQ172loBgCz406Vqz7cI= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6D49F1346D; Wed, 7 Jun 2023 18:23:17 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id oPwKFxXLgGRzBQAAMHmgww (envelope-from ); Wed, 07 Jun 2023 18:23:17 +0000 From: mwilck@suse.com To: "Martin K. Petersen" , Christoph Hellwig , Ming Lei , Bart Van Assche Cc: James Bottomley , linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, Hannes Reinecke , Martin Wilck Subject: [PATCH v3 4/8] scsi: call scsi_stop_queue() without state_mutex held Date: Wed, 7 Jun 2023 20:22:45 +0200 Message-Id: <20230607182249.22623-5-mwilck@suse.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230607182249.22623-1-mwilck@suse.com> References: <20230607182249.22623-1-mwilck@suse.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Martin Wilck sdev->state_mutex protects only sdev->sdev_state. There's no reason to keep it held while calling scsi_stop_queue(). Signed-off-by: Martin Wilck --- drivers/scsi/scsi_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ce5788643011..26e7ce25fa05 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2795,9 +2795,9 @@ static void scsi_device_block(struct scsi_device *sdev, void *data) mutex_lock(&sdev->state_mutex); err = __scsi_internal_device_block_nowait(sdev); + mutex_unlock(&sdev->state_mutex); if (err == 0) scsi_stop_queue(sdev, false); - mutex_unlock(&sdev->state_mutex); WARN_ONCE(err, "__scsi_internal_device_block_nowait(%s) failed: err = %d\n", dev_name(&sdev->sdev_gendev), err); From patchwork Wed Jun 7 18:22:46 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13271131 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 160B0C8300C for ; Wed, 7 Jun 2023 18:24:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230091AbjFGSYN (ORCPT ); Wed, 7 Jun 2023 14:24:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40304 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230479AbjFGSXv (ORCPT ); Wed, 7 Jun 2023 14:23:51 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51E6F2720; Wed, 7 Jun 2023 11:23:25 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id B6EB821A1D; Wed, 7 Jun 2023 18:23:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1686162198; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=UJ4ir9kZvluKUTzvJ/eU4h6e3nLkJg4Ew2XDi2iZvew=; b=a5fRaKQpdW6lbX/+5J3Za/WNgfwS/scHhHWQh7VETnQGdgIEvmWSmoOPQyw4X2wkzzhcFk TpHF4XrzusVRlhCM1h6nTgKCKhYagKl+ap2woHzDeFHOuDz8slwkaVa41TUXMm+IP/vwFS oQMOpMGCMUVwjkc6fzUuyV9YoAP8r3w= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 2D2471346D; Wed, 7 Jun 2023 18:23:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 0OYZBxbLgGRzBQAAMHmgww (envelope-from ); Wed, 07 Jun 2023 18:23:18 +0000 From: mwilck@suse.com To: "Martin K. Petersen" , Christoph Hellwig , Ming Lei , Bart Van Assche Cc: James Bottomley , linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, Hannes Reinecke , Martin Wilck Subject: [PATCH v3 5/8] scsi: don't wait for quiesce in scsi_stop_queue() Date: Wed, 7 Jun 2023 20:22:46 +0200 Message-Id: <20230607182249.22623-6-mwilck@suse.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230607182249.22623-1-mwilck@suse.com> References: <20230607182249.22623-1-mwilck@suse.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Martin Wilck scsi_stop_queue() has just two callers, one with and one without "nowait". As blk_mq_quiesce_queue() comes down to blk_mq_quiesce_queue_nowait() followed by blk_mq_wait_quiesce_done(), we might as well open-code this in scsi_device_block(). Signed-off-by: Martin Wilck --- drivers/scsi/scsi_lib.c | 24 +++++++++--------------- 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 26e7ce25fa05..657d10c57205 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2726,24 +2726,16 @@ void scsi_start_queue(struct scsi_device *sdev) blk_mq_unquiesce_queue(sdev->request_queue); } -static void scsi_stop_queue(struct scsi_device *sdev, bool nowait) +static void scsi_stop_queue(struct scsi_device *sdev) { /* * The atomic variable of ->queue_stopped covers that * blk_mq_quiesce_queue* is balanced with blk_mq_unquiesce_queue. * - * However, we still need to wait until quiesce is done - * in case that queue has been stopped. + * After return, we still need to wait until quiesce is done. */ - if (!cmpxchg(&sdev->queue_stopped, 0, 1)) { - if (nowait) - blk_mq_quiesce_queue_nowait(sdev->request_queue); - else - blk_mq_quiesce_queue(sdev->request_queue); - } else { - if (!nowait) - blk_mq_wait_quiesce_done(sdev->request_queue->tag_set); - } + if (!cmpxchg(&sdev->queue_stopped, 0, 1)) + blk_mq_quiesce_queue_nowait(sdev->request_queue); } /** @@ -2770,7 +2762,7 @@ int scsi_internal_device_block_nowait(struct scsi_device *sdev) * request queue. */ if (!ret) - scsi_stop_queue(sdev, true); + scsi_stop_queue(sdev); return ret; } EXPORT_SYMBOL_GPL(scsi_internal_device_block_nowait); @@ -2796,8 +2788,10 @@ static void scsi_device_block(struct scsi_device *sdev, void *data) mutex_lock(&sdev->state_mutex); err = __scsi_internal_device_block_nowait(sdev); mutex_unlock(&sdev->state_mutex); - if (err == 0) - scsi_stop_queue(sdev, false); + if (err == 0) { + scsi_stop_queue(sdev); + blk_mq_wait_quiesce_done(sdev->request_queue->tag_set); + } WARN_ONCE(err, "__scsi_internal_device_block_nowait(%s) failed: err = %d\n", dev_name(&sdev->sdev_gendev), err); From patchwork Wed Jun 7 18:22:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13271135 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0DD24C83005 for ; Wed, 7 Jun 2023 18:24:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231360AbjFGSY5 (ORCPT ); Wed, 7 Jun 2023 14:24:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232093AbjFGSYt (ORCPT ); Wed, 7 Jun 2023 14:24:49 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 363EF2680; Wed, 7 Jun 2023 11:24:25 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 5A38D1FDBB; Wed, 7 Jun 2023 18:23:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1686162199; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=PyVvtlhVYOHzbni4Ma+g7k27VybE606ANn6a+xC2doc=; b=It98T/59WnKkLnRTU9jRyl0ieB3hUfE6FfJGtdSiYvoTJjLkXD7o13ZAwVJLpNXom0T6Pq BfMTUlzBNUg7RJsD8cP0Q84OFuU1njuUfnfEufMIGUcohwKNzN7/xkwwoaG6jbUDy9M6Hg ldccRVnkr1RjJKuSjftqpCmLXxL7w2Y= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id D27B71346D; Wed, 7 Jun 2023 18:23:18 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 6B2sLxbLgGRzBQAAMHmgww (envelope-from ); Wed, 07 Jun 2023 18:23:18 +0000 From: mwilck@suse.com To: "Martin K. Petersen" , Christoph Hellwig , Ming Lei , Bart Van Assche Cc: James Bottomley , linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, Hannes Reinecke , Martin Wilck Subject: [PATCH v3 6/8] scsi: don't wait for quiesce in scsi_device_block() Date: Wed, 7 Jun 2023 20:22:47 +0200 Message-Id: <20230607182249.22623-7-mwilck@suse.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230607182249.22623-1-mwilck@suse.com> References: <20230607182249.22623-1-mwilck@suse.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Martin Wilck scsi_device_block() is only called from scsi_target_block(), which calls it repeatedly for every child device. For targets with many devices, waiting for every queue to quiesce may cause a substantial delay (we measured more than 100s delay for blocking a FC rport with 2048 LUNs). Just call blk_mq_wait_quiesce_done() once from scsi_target_block() after stopping all queues. Signed-off-by: Martin Wilck --- drivers/scsi/scsi_lib.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 657d10c57205..25ec6eb8df7f 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2772,8 +2772,8 @@ EXPORT_SYMBOL_GPL(scsi_internal_device_block_nowait); * @sdev: device to block * @data: dummy argument, ignored * - * Pause SCSI command processing on the specified device and wait until all - * ongoing scsi_queue_rq() calls have finished. May sleep. + * Pause SCSI command processing on the specified device. Callers must wait until all + * ongoing scsi_queue_rq() calls have finished after this function returns. * * Note: * This routine transitions the device to the SDEV_BLOCK state (which must be @@ -2788,10 +2788,8 @@ static void scsi_device_block(struct scsi_device *sdev, void *data) mutex_lock(&sdev->state_mutex); err = __scsi_internal_device_block_nowait(sdev); mutex_unlock(&sdev->state_mutex); - if (err == 0) { + if (err == 0) scsi_stop_queue(sdev); - blk_mq_wait_quiesce_done(sdev->request_queue->tag_set); - } WARN_ONCE(err, "__scsi_internal_device_block_nowait(%s) failed: err = %d\n", dev_name(&sdev->sdev_gendev), err); @@ -2889,11 +2887,15 @@ target_block(struct device *dev, void *data) void scsi_target_block(struct device *dev) { + struct Scsi_Host *shost = dev_to_shost(dev); + if (scsi_is_target_device(dev)) starget_for_each_device(to_scsi_target(dev), NULL, scsi_device_block); else device_for_each_child(dev, NULL, target_block); + + blk_mq_wait_quiesce_done(&shost->tag_set); } EXPORT_SYMBOL_GPL(scsi_target_block); From patchwork Wed Jun 7 18:22:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13271138 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4417DC7EE25 for ; Wed, 7 Jun 2023 18:26:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230113AbjFGS0n (ORCPT ); Wed, 7 Jun 2023 14:26:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41028 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231848AbjFGSYq (ORCPT ); Wed, 7 Jun 2023 14:24:46 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 864122134; Wed, 7 Jun 2023 11:24:23 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id D5CF221A1F; Wed, 7 Jun 2023 18:23:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1686162199; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xr1XcDgRZw9XqtqsIfNxxAv7284ffceOajLjHlMMpp4=; b=cAGzOg5ynQmo8kTz93ic/RMaAf8m7w0Ji+4mj9dd2vzAAE7l+ukLuqL9wUOdwz1RBJNhlb /whl4Kf3jCvQRzCH9f59C54ARV65DDgITDmZ0K1FhkShCOHtfNq0h/ow0hHXdDlDYc/tby WVq/m2k8NNAQqbuTlDBlcqxC3fPlsdw= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6A8321346D; Wed, 7 Jun 2023 18:23:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 0G8vGBfLgGRzBQAAMHmgww (envelope-from ); Wed, 07 Jun 2023 18:23:19 +0000 From: mwilck@suse.com To: "Martin K. Petersen" , Christoph Hellwig , Ming Lei , Bart Van Assche Cc: James Bottomley , linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, Hannes Reinecke , Martin Wilck Subject: [PATCH v3 7/8] scsi: have scsi_target_block() expect a scsi_target parent argument Date: Wed, 7 Jun 2023 20:22:48 +0200 Message-Id: <20230607182249.22623-8-mwilck@suse.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230607182249.22623-1-mwilck@suse.com> References: <20230607182249.22623-1-mwilck@suse.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Martin Wilck All callers (fc_remote_port_delete(), __iscsi_block_session(), __srp_start_tl_fail_timers(), srp_reconnect_rport(), snic_tgt_del()) pass parent devices of scsi_target devices to scsi_target_block(). Simplify scsi_target_block() to assume that it is always passed a parent device. Suggested-by: Christoph Hellwig Signed-off-by: Martin Wilck --- drivers/scsi/scsi_lib.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 25ec6eb8df7f..e572fc56a8dd 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2884,17 +2884,25 @@ target_block(struct device *dev, void *data) return 0; } +/** + * scsi_target_block - transition all SCSI child devices to SDEV_BLOCK state + * @dev: a parent device of one or more scsi_target devices + * + * Iterate over all children of @dev, which should be scsi_target devices, + * and switch all subordinate scsi devices to SDEV_BLOCK state. Wait for + * ongoing scsi_queue_rq() calls to finish. May sleep. + * + * Returns zero if successful or a negative error code upon failure. + * + * Note: + * @dev must not itself be a scsi_target device. + */ void scsi_target_block(struct device *dev) { struct Scsi_Host *shost = dev_to_shost(dev); - if (scsi_is_target_device(dev)) - starget_for_each_device(to_scsi_target(dev), NULL, - scsi_device_block); - else - device_for_each_child(dev, NULL, target_block); - + device_for_each_child(dev, NULL, target_block); blk_mq_wait_quiesce_done(&shost->tag_set); } EXPORT_SYMBOL_GPL(scsi_target_block); From patchwork Wed Jun 7 18:22:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Wilck X-Patchwork-Id: 13271132 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BD887C83005 for ; Wed, 7 Jun 2023 18:24:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230219AbjFGSYO (ORCPT ); Wed, 7 Jun 2023 14:24:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231126AbjFGSXw (ORCPT ); Wed, 7 Jun 2023 14:23:52 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2001:67c:2178:6::1d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 851142726; Wed, 7 Jun 2023 11:23:26 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 745AF1FDBC; Wed, 7 Jun 2023 18:23:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1686162200; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=o+Cf96rsnVYoJkV74n+o6P9DgzbiJfY2zq9x8K0vZcw=; b=Z19UeEhbvPDWHkNl6Hi08U0KNz66FnkBmBlvbjACilZW/WQBH+aR4GTU4AwWHwnZszAiYJ RbZ1aTRCy9qJGVCymEfv2rltbArn6nsHCCnvXkylJG5W7J6fmxr36GRT+46COolXHH8P01 ra/rt22pl3nsjA4kymL5tPGhGU0+ZoU= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id ECCE41346D; Wed, 7 Jun 2023 18:23:19 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 8BqlNhfLgGRzBQAAMHmgww (envelope-from ); Wed, 07 Jun 2023 18:23:19 +0000 From: mwilck@suse.com To: "Martin K. Petersen" , Christoph Hellwig , Ming Lei , Bart Van Assche Cc: James Bottomley , linux-scsi@vger.kernel.org, linux-block@vger.kernel.org, Hannes Reinecke , Martin Wilck , Bart Van Assche , Karan Tilak Kumar , Sesidhar Baddela Subject: [PATCH v3 8/8] scsi: add Scsi_Host argument to scsi_target_block() Date: Wed, 7 Jun 2023 20:22:49 +0200 Message-Id: <20230607182249.22623-9-mwilck@suse.com> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230607182249.22623-1-mwilck@suse.com> References: <20230607182249.22623-1-mwilck@suse.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org From: Martin Wilck Instead of deriving the Scsi_Host from dev_to_shost, require callers to pass in the Scsi_Host the given device belongs to. Suggested-by: Bart Van Assche Signed-off-by: Martin Wilck Cc: Karan Tilak Kumar Cc: Sesidhar Baddela --- drivers/scsi/scsi_lib.c | 5 ++--- drivers/scsi/scsi_transport_fc.c | 2 +- drivers/scsi/scsi_transport_iscsi.c | 3 ++- drivers/scsi/scsi_transport_srp.c | 4 ++-- drivers/scsi/snic/snic_disc.c | 2 +- include/scsi/scsi_device.h | 2 +- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index e572fc56a8dd..b89d69a5bab0 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -2887,6 +2887,7 @@ target_block(struct device *dev, void *data) /** * scsi_target_block - transition all SCSI child devices to SDEV_BLOCK state * @dev: a parent device of one or more scsi_target devices + * @shost: the Scsi_Host to which this device belongs * * Iterate over all children of @dev, which should be scsi_target devices, * and switch all subordinate scsi devices to SDEV_BLOCK state. Wait for @@ -2898,10 +2899,8 @@ target_block(struct device *dev, void *data) * @dev must not itself be a scsi_target device. */ void -scsi_target_block(struct device *dev) +scsi_target_block(struct device *dev, struct Scsi_Host *shost) { - struct Scsi_Host *shost = dev_to_shost(dev); - device_for_each_child(dev, NULL, target_block); blk_mq_wait_quiesce_done(&shost->tag_set); } diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 64ff2629eaf9..3155565e66f1 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -3451,7 +3451,7 @@ fc_remote_port_delete(struct fc_rport *rport) spin_unlock_irqrestore(shost->host_lock, flags); - scsi_target_block(&rport->dev); + scsi_target_block(&rport->dev, shost); /* see if we need to kill io faster than waiting for device loss */ if ((rport->fast_io_fail_tmo != -1) && diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index b9b97300e3b3..9f2f4c9403de 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c @@ -1943,13 +1943,14 @@ static void __iscsi_block_session(struct work_struct *work) struct iscsi_cls_session *session = container_of(work, struct iscsi_cls_session, block_work); + struct Scsi_Host *shost = iscsi_session_to_shost(session); unsigned long flags; ISCSI_DBG_TRANS_SESSION(session, "Blocking session\n"); spin_lock_irqsave(&session->lock, flags); session->state = ISCSI_SESSION_FAILED; spin_unlock_irqrestore(&session->lock, flags); - scsi_target_block(&session->dev); + scsi_target_block(&session->dev, shost); ISCSI_DBG_TRANS_SESSION(session, "Completed SCSI target blocking\n"); if (session->recovery_tmo >= 0) queue_delayed_work(session->workq, diff --git a/drivers/scsi/scsi_transport_srp.c b/drivers/scsi/scsi_transport_srp.c index 87d0fb8dc503..8219180a7b58 100644 --- a/drivers/scsi/scsi_transport_srp.c +++ b/drivers/scsi/scsi_transport_srp.c @@ -480,7 +480,7 @@ static void __srp_start_tl_fail_timers(struct srp_rport *rport) srp_rport_set_state(rport, SRP_RPORT_BLOCKED) == 0) { pr_debug("%s new state: %d\n", dev_name(&shost->shost_gendev), rport->state); - scsi_target_block(&shost->shost_gendev); + scsi_target_block(&shost->shost_gendev, shost); if (fast_io_fail_tmo >= 0) queue_delayed_work(system_long_wq, &rport->fast_io_fail_work, @@ -548,7 +548,7 @@ int srp_reconnect_rport(struct srp_rport *rport) * later is ok though, scsi_internal_device_unblock_nowait() * treats SDEV_TRANSPORT_OFFLINE like SDEV_BLOCK. */ - scsi_target_block(&shost->shost_gendev); + scsi_target_block(&shost->shost_gendev, shost); res = rport->state != SRP_RPORT_LOST ? i->f->reconnect(rport) : -ENODEV; pr_debug("%s (state %d): transport.reconnect() returned %d\n", dev_name(&shost->shost_gendev), rport->state, res); diff --git a/drivers/scsi/snic/snic_disc.c b/drivers/scsi/snic/snic_disc.c index 8fbf3c1b1311..3749853439ac 100644 --- a/drivers/scsi/snic/snic_disc.c +++ b/drivers/scsi/snic/snic_disc.c @@ -214,7 +214,7 @@ snic_tgt_del(struct work_struct *work) scsi_flush_work(shost); /* Block IOs on child devices, stops new IOs */ - scsi_target_block(&tgt->dev); + scsi_target_block(&tgt->dev, shost); /* Cleanup IOs */ snic_tgt_scsi_abort_io(tgt); diff --git a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h index b2cdb078b7bd..9fd76b71b533 100644 --- a/include/scsi/scsi_device.h +++ b/include/scsi/scsi_device.h @@ -456,7 +456,7 @@ extern void scsi_scan_target(struct device *parent, unsigned int channel, unsigned int id, u64 lun, enum scsi_scan_mode rescan); extern void scsi_target_reap(struct scsi_target *); -extern void scsi_target_block(struct device *); +extern void scsi_target_block(struct device *, struct Scsi_Host *); extern void scsi_target_unblock(struct device *, enum scsi_device_state); extern void scsi_remove_target(struct device *); extern const char *scsi_device_state_name(enum scsi_device_state);