From patchwork Sat Mar 25 01:17:30 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 74803 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp133452vqo; Fri, 24 Mar 2023 18:19:30 -0700 (PDT) X-Google-Smtp-Source: AKy350bNtQnoW/R9syJCSkIRlz4pha03P/AfAC/H91bHoZA/LXAr771Nxg4lG9Cr8mqB2qiMKaGa X-Received: by 2002:a17:90a:a66:b0:237:c52f:a54d with SMTP id o93-20020a17090a0a6600b00237c52fa54dmr10805317pjo.21.1679707169959; Fri, 24 Mar 2023 18:19:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679707169; cv=none; d=google.com; s=arc-20160816; b=rHJYgApKr2bmp1zcP9mG8qacPyLfPiafzBMBtt7PQ4CK4mB+ADvz1oNpq31GGI9f/3 GcwlpbhkzgzXLxE3wzp59pSc0q09FR+1bsKllIa9+sOHe1KvhctTQvbmpbTg3d537Jxa Cf7Q/uwcTd2Sob51zuM5DlgSfBJg7ZEqiaCUDGQIydflRwQPSHOXUJjpwF8teIW6K4is fkNSKmj+r9bBIUo6FHkLYMD3Fx3TYCkBAHWNCdbL9xnaCEbjTqwgzrrGJgR7V/bJZ4k1 ubFxYax2O8LkEJNjvd7xVjmH5Hg7r/ZkBtrrK5E5S9UNCnEqheRPhPMnCEtoyMYxOxav FoYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=vi542iX6hrQ2Lrfh0b71xX+tOq3WDYP9v1njrLx2sqk=; b=HAvbwvB7YEflvfanrRWFygr6dse3mNehrUDLpdriepJL7sNn3PkzG6fakxA9R5ezcF vDkfMMqomZl5zRZ5hd7E37cl4YRVsiC+aUs9CpjX/GLhrqbFSSFXDOSYmhEqaJ8XTUyS kiZo1vNmHLwtkgJN7loSdzQ7pxhJSHMxqb+ZB72f5zay6lfOUKMrrhKVwLXyu2yd0Q8F S2Btoe2qu48ykz9nmZOQJZKBkViKGrF+n/KunDZfVtBgEfurozxBOdrnphqCWSmH/NWm YeA4WwjqumQtj7kCoN/3v8H7HejGWCa5atCgE1gM5en/BuxSaWnJRwtVSREDocC5SuDY XZ0Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q65-20020a632a44000000b0050fa6fbde46si11452901pgq.492.2023.03.24.18.19.17; Fri, 24 Mar 2023 18:19:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232152AbjCYBSz (ORCPT + 99 others); Fri, 24 Mar 2023 21:18:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229920AbjCYBSk (ORCPT ); Fri, 24 Mar 2023 21:18:40 -0400 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C71531A64D; Fri, 24 Mar 2023 18:18:38 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Pk1Rt1zqmz4f3v4j; Sat, 25 Mar 2023 09:18:34 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP3 (Coremail) with SMTP id _Ch0CgCnUiDpSx5kmy0NFg--.49234S5; Sat, 25 Mar 2023 09:18:35 +0800 (CST) From: Ye Bin To: jejb@linux.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ye Bin Subject: [PATCH 1/5] scsi: fix switch host state race between by sysfs and others Date: Sat, 25 Mar 2023 09:17:30 +0800 Message-Id: <20230325011734.507453-2-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230325011734.507453-1-yebin@huaweicloud.com> References: <20230325011734.507453-1-yebin@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: _Ch0CgCnUiDpSx5kmy0NFg--.49234S5 X-Coremail-Antispam: 1UD129KBjvJXoWrtrykGFWxZw15JF4kur17Wrg_yoW8Jry8pF WDJa4a9w4Uuws2gwsI9r45Xr9xK34kGrnFgFWIgwn5AFy8J3y5Kws5Ca4UXay5JFWxWFs7 JF4Dtr98CayUtF7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvmb4IE77IF4wAFF20E14v26r4j6ryUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUGw A2048vs2IY020Ec7CjxVAFwI0_Jrv_JF4l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV WxJVW8Jr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAFwI0_ GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2WlYx 0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkEbVWU JVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbVWUJV W8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF67kF 1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUJVWUCwCI42IY6x IIjxv20xvEc7CjxVAFwI0_Jr0_Gr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF0xvE x4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Jr0_GrUvcSsGvfC2KfnxnU UI43ZEXa7IU14CJJUUUUU== X-CM-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761300625386000234?= X-GMAIL-MSGID: =?utf-8?q?1761300625386000234?= From: Ye Bin Now, switch host state by sysfs isn't hold 'shost->host_lock' lock. It may race with other process, lead to host mixed state. Signed-off-by: Ye Bin --- drivers/scsi/scsi_sysfs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index ee28f73af4d4..cc0ae5e3def3 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -202,6 +202,7 @@ store_shost_state(struct device *dev, struct device_attribute *attr, int i; struct Scsi_Host *shost = class_to_shost(dev); enum scsi_host_state state = 0; + unsigned long flags; for (i = 0; i < ARRAY_SIZE(shost_states); i++) { const int len = strlen(shost_states[i].name); @@ -214,8 +215,13 @@ store_shost_state(struct device *dev, struct device_attribute *attr, if (!state) return -EINVAL; - if (scsi_host_set_state(shost, state)) + spin_lock_irqsave(shost->host_lock, flags); + if (scsi_host_set_state(shost, state)) { + spin_unlock_irqrestore(shost->host_lock, flags); return -EINVAL; + } + spin_unlock_irqrestore(shost->host_lock, flags); + return count; } From patchwork Sat Mar 25 01:17:31 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 74808 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp151004vqo; Fri, 24 Mar 2023 19:12:04 -0700 (PDT) X-Google-Smtp-Source: AKy350YHYze664g2tFTiQsMfa8Fw/fZuR5fwWvfzelIqORLuk8PCZL59C1jyNw9oLD9zrT2pLb6d X-Received: by 2002:a17:907:2be8:b0:877:8a55:2a26 with SMTP id gv40-20020a1709072be800b008778a552a26mr4192533ejc.60.1679710324430; Fri, 24 Mar 2023 19:12:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679710324; cv=none; d=google.com; s=arc-20160816; b=YCQ5gy3SVy7xQPWZCeB7OIDKuue4wdGFoPK7rvI6K8JjilmY7CM3tgOEmfbJrYht3z vCUUQMd3RNwz9+67m0Tl1SHjo/uhrMlmbdbWSzYJobgkAun+pkeH4caq9vGNHOTz7igC nF/wSvugXIu5pIXU4xvIKnyQr1cZEtoAiBC4fnMfR/PKvjg+G57jjyKMWCP2kPsgTnBh zPbwryq9kMz1xmpXnTHyqKva5PWO80qBjUDxJBkX0F4eEQ40N84nVLUOEheG11dJGV1L iM9rlLgAZpHzu7RScrRa9n6Vy+iKvFdXYyyX29ydT8CCkLRB3IlkLsGmAQnrbJb1HaGP ypGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Ewu+eFMD3vqKfpsp4JRgmmV37DeX2wtnKSLW/qsFXO8=; b=orEQksH1UJFG4qU/XFDcvveR+rG2jB8KPeLKZa1oWQ6M6TBJq/3TxRosZXWN2Ffsbg c9LjqLx/FU+lx8QpnQ8iHDGVnzEBFERj2a806uArAtvPXj2mOM0+PAK6784OTYA0eSq0 9xtOMMHWgk4g1k2TRMFHuOZCOrhIPRMQZgFUZoJuOB/EYaUdjDVRlWDRhdT8iZMZ8OvG +bYX/f+ZLtFrIOyycZWK8gE8uHqAZzM+KNWPjV+ZrrCOkoa6ZgV7o1Bt3hcHLiDIQQzk 7MmPLDTWx/r7tc72FOai/fJaiOXIpvOx0zf7julvkzHnre9eYcMBR9+HWVtfNsZ2X98g bOnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id c25-20020a170906341900b0093018c7c47csi20591115ejb.10.2023.03.24.19.11.40; Fri, 24 Mar 2023 19:12:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232177AbjCYBS6 (ORCPT + 99 others); Fri, 24 Mar 2023 21:18:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231716AbjCYBSk (ORCPT ); Fri, 24 Mar 2023 21:18:40 -0400 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A68381A94A; Fri, 24 Mar 2023 18:18:38 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4Pk1Rt1cfDz4f3mLK; Sat, 25 Mar 2023 09:18:34 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP3 (Coremail) with SMTP id _Ch0CgCnUiDpSx5kmy0NFg--.49234S6; Sat, 25 Mar 2023 09:18:36 +0800 (CST) From: Ye Bin To: jejb@linux.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ye Bin Subject: [PATCH 2/5] scsi: introduce SHOST_BLOCKED state to support blocking IO Date: Sat, 25 Mar 2023 09:17:31 +0800 Message-Id: <20230325011734.507453-3-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230325011734.507453-1-yebin@huaweicloud.com> References: <20230325011734.507453-1-yebin@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: _Ch0CgCnUiDpSx5kmy0NFg--.49234S6 X-Coremail-Antispam: 1UD129KBjvJXoW7tr4xGw47ur4DuF4xury7trb_yoW8KryfpF WDXw1xC3y8GayIkwnIg3Z8Gr95Ka97WrWqqFyUWa47Wa4jy34Y9w4DCFyUZay8GrW7Krnx WF4DWF1DCFWrJrUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvGb4IE77IF4wAFF20E14v26ryj6rWUM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUXw A2048vs2IY020Ec7CjxVAFwI0_JFI_Gr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMc Ij6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_ Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr 0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY 17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcV C0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY 6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa 73UjIFyTuYvjxUzMKuUUUUU X-CM-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761303932997504603?= X-GMAIL-MSGID: =?utf-8?q?1761303932997504603?= From: Ye Bin SHOST_BLOCKED state to blocking io in block layer. This state use for test, Only running state and blocked state can be switched to each other. Signed-off-by: Ye Bin --- drivers/scsi/hosts.c | 11 +++++++++++ drivers/scsi/scsi_sysfs.c | 1 + include/scsi/scsi_host.h | 1 + 3 files changed, 13 insertions(+) diff --git a/drivers/scsi/hosts.c b/drivers/scsi/hosts.c index 9b6fbbe15d92..3b497fd4d329 100644 --- a/drivers/scsi/hosts.c +++ b/drivers/scsi/hosts.c @@ -90,6 +90,7 @@ int scsi_host_set_state(struct Scsi_Host *shost, enum scsi_host_state state) switch (oldstate) { case SHOST_CREATED: case SHOST_RECOVERY: + case SHOST_BLOCKED: break; default: goto illegal; @@ -99,6 +100,7 @@ int scsi_host_set_state(struct Scsi_Host *shost, enum scsi_host_state state) case SHOST_RECOVERY: switch (oldstate) { case SHOST_RUNNING: + case SHOST_BLOCKED: break; default: goto illegal; @@ -109,6 +111,7 @@ int scsi_host_set_state(struct Scsi_Host *shost, enum scsi_host_state state) switch (oldstate) { case SHOST_CREATED: case SHOST_RUNNING: + case SHOST_BLOCKED: case SHOST_CANCEL_RECOVERY: break; default: @@ -144,6 +147,14 @@ int scsi_host_set_state(struct Scsi_Host *shost, enum scsi_host_state state) goto illegal; } break; + case SHOST_BLOCKED: + switch (oldstate) { + case SHOST_RUNNING: + break; + default: + goto illegal; + } + break; } shost->shost_state = state; return 0; diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index cc0ae5e3def3..b14f95ac594e 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -69,6 +69,7 @@ static const struct { { SHOST_RECOVERY, "recovery" }, { SHOST_CANCEL_RECOVERY, "cancel/recovery" }, { SHOST_DEL_RECOVERY, "deleted/recovery", }, + { SHOST_BLOCKED, "blocked", }, }; const char *scsi_host_state_name(enum scsi_host_state state) { diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 587cc767bb67..9e99317b11fa 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -527,6 +527,7 @@ enum scsi_host_state { SHOST_RECOVERY, SHOST_CANCEL_RECOVERY, SHOST_DEL_RECOVERY, + SHOST_BLOCKED, }; struct Scsi_Host { From patchwork Sat Mar 25 01:17:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 74807 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp150583vqo; Fri, 24 Mar 2023 19:10:50 -0700 (PDT) X-Google-Smtp-Source: AKy350YKd9xfy4rP2F0PT/FAbj97Mes66N7aO6b/Mt+EZL+8F/08UcipWWY7GDZhuYFmbtpD6Jla X-Received: by 2002:a17:906:524a:b0:931:7709:4c80 with SMTP id y10-20020a170906524a00b0093177094c80mr4427143ejm.71.1679710250030; Fri, 24 Mar 2023 19:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679710250; cv=none; d=google.com; s=arc-20160816; b=0RL5jTaV/0+urSymbs26Op8/SQ45o530bwVh1DBTOQsdGH/ZSjKpchRZU0bVgntBTE +3a1ln3AhwALatmvsvYsHdXsQMMvs6jAAiRFIdYOyToxQ7iMW/WuNI9tysT4s8RFFfnk plFN/RAmKdXoQYGwd33MQKbMrSzeJhNsGv4exqc7UZMuU52M/kFWMgATQeZgk/Qv1nRO L23GoBbVY43Gw28ZCKZkm11Daj39QwbPjAowArH+5OJsgqQukHeUrN44nnEDB7ui+wdO 3nINhoHCc0dCm4LxsAAOAVHYjqGFZYhIZGEURKnZoz7HAPK8Gw/qyK6+E5e+qSblHxZJ F1Xg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=CnSv/gmC+c2ApMXQAKptf6oyE6tTjrVGa9rsvthm34Y=; b=RHz2v5yEesPrD3lcp1Fn6c/eFcNAYZhJhTsxDdSudv946hhpRyQCPorMJfzzCykP5o A7GW5F00dDGgSrg2m401DT3ZXxFO97t4WqkTytodvHZ16XI8mI8SPQJEDbZmqa8c5zVY RuMfCyJvhbgjDb0COoJwSL+T6siNh8GVzoksgM8VyuYpX7gAsRFAB3QKvr+CYelgjU1a OdRUpTYxLY7IkHHxbIY8HerOFpFwDNoBCxsVichhNI1kP8rxj6vUgHXrYnEzNCVvEtcm tk5uLYSNQlYMFgpF05JwYuEdq/W9nr7lraEDMUoQ8i8Js0J1vVQyO+S0Tma2nWs25yTO TThg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w19-20020a17090649d300b008b20e95d477si5312161ejv.620.2023.03.24.19.10.27; Fri, 24 Mar 2023 19:10:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232119AbjCYBSv (ORCPT + 99 others); Fri, 24 Mar 2023 21:18:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34854 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231913AbjCYBSk (ORCPT ); Fri, 24 Mar 2023 21:18:40 -0400 Received: from dggsgout12.his.huawei.com (dggsgout12.his.huawei.com [45.249.212.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE36F1A950; Fri, 24 Mar 2023 18:18:38 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout12.his.huawei.com (SkyGuard) with ESMTP id 4Pk1Rt3QHsz4f3mLW; Sat, 25 Mar 2023 09:18:34 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP3 (Coremail) with SMTP id _Ch0CgCnUiDpSx5kmy0NFg--.49234S7; Sat, 25 Mar 2023 09:18:36 +0800 (CST) From: Ye Bin To: jejb@linux.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ye Bin Subject: [PATCH 3/5] scsi: limit to set the host state Date: Sat, 25 Mar 2023 09:17:32 +0800 Message-Id: <20230325011734.507453-4-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230325011734.507453-1-yebin@huaweicloud.com> References: <20230325011734.507453-1-yebin@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: _Ch0CgCnUiDpSx5kmy0NFg--.49234S7 X-Coremail-Antispam: 1UD129KBjvJXoW7ArWfKFy7WFykXFy5Kr47CFg_yoW8GFWkpF WDJa4agw4UWas7Kws3Wrs8Wr9xK348WryqgFZ2g34ruF18J3y5Ka1kCa45ZF45JFWfCFn7 JF4qqF98Cay0yFUanT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvGb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUWw A2048vs2IY020Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0rcxS w2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267AKxV W8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E14v2 6rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7xfMc Ij6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Yz7v_ Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7v_Jr 0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF1VAY 17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIxAIcV C0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI42IY 6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWIevJa 73UjIFyTuYvjxU2PEfUUUUU X-CM-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761303855444164856?= X-GMAIL-MSGID: =?utf-8?q?1761303855444164856?= From: Ye Bin Now, we can set the host state with any value. Actually, it doesn't make sense. As previous patch introduce SHOST_BLOCKED state, set this state, it will blocking IO. So this patch limit to set the host with running/blocked state. Signed-off-by: Ye Bin --- drivers/scsi/scsi_sysfs.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index b14f95ac594e..42c5936c7711 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -203,6 +203,7 @@ store_shost_state(struct device *dev, struct device_attribute *attr, int i; struct Scsi_Host *shost = class_to_shost(dev); enum scsi_host_state state = 0; + enum scsi_host_state old_state; unsigned long flags; for (i = 0; i < ARRAY_SIZE(shost_states); i++) { @@ -216,8 +217,13 @@ store_shost_state(struct device *dev, struct device_attribute *attr, if (!state) return -EINVAL; + if (state != SHOST_RUNNING && state != SHOST_BLOCKED) + return -EINVAL; + spin_lock_irqsave(shost->host_lock, flags); - if (scsi_host_set_state(shost, state)) { + old_state = shost->shost_state; + if ((old_state != SHOST_RUNNING && old_state != SHOST_BLOCKED) || + scsi_host_set_state(shost, state)) { spin_unlock_irqrestore(shost->host_lock, flags); return -EINVAL; } From patchwork Sat Mar 25 01:17:33 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 74804 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp133502vqo; Fri, 24 Mar 2023 18:19:39 -0700 (PDT) X-Google-Smtp-Source: AKy350acMexyS5qJEVgXhirPxCIYDftcIc+2yAVieew0pFBF0ljFc0x/H1TVnFWxy/4mU3BPiTgt X-Received: by 2002:a17:903:2347:b0:1a1:e14f:3750 with SMTP id c7-20020a170903234700b001a1e14f3750mr5562184plh.1.1679707179120; Fri, 24 Mar 2023 18:19:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679707179; cv=none; d=google.com; s=arc-20160816; b=bZkHAJYoiq1Kq3FwQIiQ3Qwl8pCxEC0NJtf3yE5qer2RkOMClyH/L7bX3mZmOXljLZ w9PZKCjr3C/iL+DwqQeBpKPyVRrh7cu7DdClaqAWKNOlHyGACBpGC1ZOoNVf8grKrBnk 1UpQqmgHVhTb/zz3WJVQ/6ZRDp0gD62ZGJ8X9xYF3TOrKKC1s/GCW6bazWlEx0xjzNGL GZeY4AdwG3M13vkPpjqN3YDHeuSNyQ5nilRpP9ifUFU7ImesHgBImkO+utNmoanamaRr dqD93coGwZP5UqoV2ZdxOupHvc/P/UeQknACmh8QfEEjHp82YX3X8vkFkCmrI4NJBXF2 AaMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=m+YK0TkKG5igifNQPgrzatLosHOh2aGtA/QuowwtVgA=; b=nYO59Gf+TMSKDp532hoqpFRT29KeCv5OZy8OvoQb2cFI8tWobuZ8pOk7SMiBx+0WVW LHz6kmBBpkQa0OyQdpdw483njmbpkyxGrltYPV1oihWFCSoeDJMv4AFo31KW/iuhE7bA W3I8NjXF280U4cBSWJIXRvA+FnOorBrAB2lL6hTFor+3Vz3j1oEltFOygaoyM8Y7gTSr Cqb4oVCzCRpJGlk2qMSZ+T0JytFPJC6NnCCR0PZSEd/Ejzp6yKBIk1Y/2/cmIlbXOCc/ GUAl0THcKsZd4tSbsffQQ7deoZHXg3am4LWAqJCcKsJLjHBskT+RGdYl/VJaytlwoZBq lw3g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h34-20020a632122000000b00507806546e7si22307014pgh.501.2023.03.24.18.19.26; Fri, 24 Mar 2023 18:19:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232110AbjCYBTB (ORCPT + 99 others); Fri, 24 Mar 2023 21:19:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34970 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231950AbjCYBSl (ORCPT ); Fri, 24 Mar 2023 21:18:41 -0400 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A93321A95D; Fri, 24 Mar 2023 18:18:39 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Pk1Rt6wlZz4f3lXK; Sat, 25 Mar 2023 09:18:34 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP3 (Coremail) with SMTP id _Ch0CgCnUiDpSx5kmy0NFg--.49234S8; Sat, 25 Mar 2023 09:18:36 +0800 (CST) From: Ye Bin To: jejb@linux.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ye Bin Subject: [PATCH 4/5] scsi: blocking IO when host is blocked Date: Sat, 25 Mar 2023 09:17:33 +0800 Message-Id: <20230325011734.507453-5-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230325011734.507453-1-yebin@huaweicloud.com> References: <20230325011734.507453-1-yebin@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: _Ch0CgCnUiDpSx5kmy0NFg--.49234S8 X-Coremail-Antispam: 1UD129KBjvJXoW7urWrXr48tr4kCr13Cw4Uurg_yoW8Gr48pF Z0qa42kr48GFW09a98WF15XrySgayDGryUJa4fWwn8JF98t34jqan8GFyUXFy8GF4Fkrsr XFsrtFyYkF1UXr7anT9S1TB71UUUUUUqnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDU0xBIdaVrnRJUUUvEb4IE77IF4wAFF20E14v26rWj6s0DM7CY07I20VC2zVCF04k2 6cxKx2IYs7xG6rWj6s0DM7CIcVAFz4kK6r1j6r18M28IrcIa0xkI8VA2jI8067AKxVWUAV Cq3wA2048vs2IY020Ec7CjxVAFwI0_Gr0_Xr1l8cAvFVAK0II2c7xJM28CjxkF64kEwVA0 rcxSw2x7M28EF7xvwVC0I7IYx2IY67AKxVW7JVWDJwA2z4x0Y4vE2Ix0cI8IcVCY1x0267 AKxVW8Jr0_Cr1UM28EF7xvwVC2z280aVAFwI0_GcCE3s1l84ACjcxK6I8E87Iv6xkF7I0E 14v26rxl6s0DM2AIxVAIcxkEcVAq07x20xvEncxIr21l5I8CrVACY4xI64kE6c02F40Ex7 xfMcIj6xIIjxv20xvE14v26r1j6r18McIj6I8E87Iv67AKxVWUJVW8JwAm72CE4IkC6x0Y z7v_Jr0_Gr1lF7xvr2IYc2Ij64vIr41l42xK82IYc2Ij64vIr41l4I8I3I0E4IkC6x0Yz7 v_Jr0_Gr1lx2IqxVAqx4xG67AKxVWUJVWUGwC20s026x8GjcxK67AKxVWUGVWUWwC2zVAF 1VAY17CE14v26r126r1DMIIYrxkI7VAKI48JMIIF0xvE2Ix0cI8IcVAFwI0_Jr0_JF4lIx AIcVC0I7IYx2IY6xkF7I0E14v26r4j6F4UMIIF0xvE42xK8VAvwI8IcIk0rVWUJVWUCwCI 42IY6I8E87Iv67AKxVWUJVW8JwCI42IY6I8E87Iv6xkF7I0E14v26r4j6r4UJbIYCTnIWI evJa73UjIFyTuYvjxU2CJmUUUUU X-CM-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761300635097008050?= X-GMAIL-MSGID: =?utf-8?q?1761300635097008050?= From: Ye Bin Unlike recovery state may block other process, blocking IO only when host is blocked. Signed-off-by: Ye Bin --- drivers/scsi/scsi_lib.c | 4 ++++ include/scsi/scsi_host.h | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index b7c569a42aa4..492487717f41 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1731,6 +1731,10 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx, ret = BLK_STS_OFFLINE; goto out_dec_target_busy; } + + if (unlikely(scsi_host_blocked(shost))) + goto out_dec_target_busy; + if (!scsi_host_queue_ready(q, shost, sdev, cmd)) goto out_dec_target_busy; diff --git a/include/scsi/scsi_host.h b/include/scsi/scsi_host.h index 9e99317b11fa..571321bbb706 100644 --- a/include/scsi/scsi_host.h +++ b/include/scsi/scsi_host.h @@ -745,6 +745,11 @@ static inline int scsi_host_in_recovery(struct Scsi_Host *shost) shost->tmf_in_progress; } +static inline int scsi_host_blocked(struct Scsi_Host *shost) +{ + return shost->shost_state == SHOST_BLOCKED; +} + extern int scsi_queue_work(struct Scsi_Host *, struct work_struct *); extern void scsi_flush_work(struct Scsi_Host *); From patchwork Sat Mar 25 01:17:34 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ye Bin X-Patchwork-Id: 74806 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp141482vqo; Fri, 24 Mar 2023 18:44:27 -0700 (PDT) X-Google-Smtp-Source: AKy350bcL8fnY6uUH/nLriGZ8dWeMB8O2JndtrmqjhhR45DB1mGI5rMpOu+nxg73+uU+B0TixHSE X-Received: by 2002:aa7:dd57:0:b0:501:fd71:7e11 with SMTP id o23-20020aa7dd57000000b00501fd717e11mr4971161edw.20.1679708667202; Fri, 24 Mar 2023 18:44:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679708667; cv=none; d=google.com; s=arc-20160816; b=CGVw4bhmwnKsTo6TjHcIg99G0ms48EU5ZHduvDJz85ZC/4bX3EtYmlV45+FF5rc1Oc Qe85rvrzjwpXk3iXWzNrY/L4iusimzxAfJ5PbtA63cPxTesFzWlFZXunKlmYfKtSK1ms I9ATZ1IYZWycEEjvEhN7cN06wvsPrEKITSQ3Yji8SszW0AciWjV5K578NwPbG27Vt2j6 ykz9mE/0+DyMv/X6JoYosr2SRwjSZc4ydm5tbvB2qHnTzx4mX168BGTqwwt2PXHQ0eYE nrAqexRXkQ/x8bmcrmG40Co24liD7ko5XAD/v8aeOIYsaLn2aN5gjrN+tV5ihNEWzI3r wheg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Z/jaitCuxlYdLTL5oF056Nwj2hIvUNCVrCEuwCO2Tfo=; b=YUZtFcmIrEc/29gMsZfh4i5vyHHI/5sboGEVl9+qy0qluA7sLdc9GH/3RRLN3ZQyMh +bgoWdZF5SwymKCKHYpCbjyEPEcJcHrCEw8MgwWIdNtXcZDJHDbaYs82KLRxZrbg2FF9 VQqu2Rb84+NwGRVAz4fD5qUMrK/5xLsi6f22H3+qsMvSzCdPYIR9Ex1E6LdxlCXJlcRg 0ViMtjyLT4Eh23pg1vi4LXYcHaXBQFus6wknW64kqLYdy66ufkq6zSlda9BUp0syfqRF lKC0raLVu366VQJIHJK1K6a5AWZ4c9zwqMbC6UriCEPLDUzCv7zWCkj7jfbgpvCdH8+q 2ZUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020aa7d284000000b004fe9bb8eb0asi21463027edq.587.2023.03.24.18.43.57; Fri, 24 Mar 2023 18:44:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232147AbjCYBTG (ORCPT + 99 others); Fri, 24 Mar 2023 21:19:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231956AbjCYBSl (ORCPT ); Fri, 24 Mar 2023 21:18:41 -0400 Received: from dggsgout11.his.huawei.com (dggsgout11.his.huawei.com [45.249.212.51]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8FD281A95B; Fri, 24 Mar 2023 18:18:39 -0700 (PDT) Received: from mail02.huawei.com (unknown [172.30.67.169]) by dggsgout11.his.huawei.com (SkyGuard) with ESMTP id 4Pk1Rv2lNwz4f3v4Z; Sat, 25 Mar 2023 09:18:35 +0800 (CST) Received: from huaweicloud.com (unknown [10.175.127.227]) by APP3 (Coremail) with SMTP id _Ch0CgCnUiDpSx5kmy0NFg--.49234S9; Sat, 25 Mar 2023 09:18:36 +0800 (CST) From: Ye Bin To: jejb@linux.ibm.com, martin.petersen@oracle.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Ye Bin Subject: [PATCH 5/5] scsi: run queue after set host state from blocked to running Date: Sat, 25 Mar 2023 09:17:34 +0800 Message-Id: <20230325011734.507453-6-yebin@huaweicloud.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20230325011734.507453-1-yebin@huaweicloud.com> References: <20230325011734.507453-1-yebin@huaweicloud.com> MIME-Version: 1.0 X-CM-TRANSID: _Ch0CgCnUiDpSx5kmy0NFg--.49234S9 X-Coremail-Antispam: 1UD129KBjvdXoWruryrGrW7KF1kCFy3Cr4fuFg_yoW3WFc_u3 y09F93K3yfta1rK395try5XF9Y9w4Fqa4kuF4YqFWS9w4jqFykt3yI9r98Zr4UuF4xAa17 Aw1kZ34IkF9rJjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUIcSsGvfJTRUUUbVAYFVCjjxCrM7AC8VAFwI0_Wr0E3s1l1xkIjI8I6I8E6xAIw20E Y4v20xvaj40_Wr0E3s1l1IIY67AEw4v_Jr0_Jr4l82xGYIkIc2x26280x7IE14v26r126s 0DM28IrcIa0xkI8VCY1x0267AKxVW5JVCq3wA2ocxC64kIII0Yj41l84x0c7CEw4AK67xG Y2AK021l84ACjcxK6xIIjxv20xvE14v26F1j6w1UM28EF7xvwVC0I7IYx2IY6xkF7I0E14 v26r4UJVWxJr1l84ACjcxK6I8E87Iv67AKxVW0oVCq3wA2z4x0Y4vEx4A2jsIEc7CjxVAF wI0_GcCE3s1le2I262IYc4CY6c8Ij28IcVAaY2xG8wAqx4xG64xvF2IEw4CE5I8CrVC2j2 WlYx0E2Ix0cI8IcVAFwI0_Jr0_Jr4lYx0Ex4A2jsIE14v26r1j6r4UMcvjeVCFs4IE7xkE bVWUJVW8JwACjcxG0xvY0x0EwIxGrwCF04k20xvY0x0EwIxGrwCFx2IqxVCFs4IE7xkEbV WUJVW8JwC20s026c02F40E14v26r1j6r18MI8I3I0E7480Y4vE14v26r106r1rMI8E67AF 67kF1VAFwI0_JF0_Jw1lIxkGc2Ij64vIr41lIxAIcVC0I7IYx2IY67AKxVWUCVW8JwCI42 IY6xIIjxv20xvEc7CjxVAFwI0_Gr0_Cr1lIxAIcVCF04k26cxKx2IYs7xG6r1j6r1xMIIF 0xvEx4A2jsIE14v26r1j6r4UMIIF0xvEx4A2jsIEc7CjxVAFwI0_Gr0_Gr1UYxBIdaVFxh VjvjDU0xZFpf9x07UZo7tUUUUU= X-CM-SenderInfo: p1hex046kxt4xhlfz01xgou0bp/ X-CFilter-Loop: Reflected X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761302195462322250?= X-GMAIL-MSGID: =?utf-8?q?1761302195462322250?= From: Ye Bin As when host is blocked, all request is blocked. After set the host state with running, e will need to ensure that these requests are started. Signed-off-by: Ye Bin --- drivers/scsi/scsi_sysfs.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c index 42c5936c7711..202d58f4f267 100644 --- a/drivers/scsi/scsi_sysfs.c +++ b/drivers/scsi/scsi_sysfs.c @@ -229,6 +229,9 @@ store_shost_state(struct device *dev, struct device_attribute *attr, } spin_unlock_irqrestore(shost->host_lock, flags); + if (old_state == SHOST_BLOCKED && state == SHOST_RUNNING) + scsi_run_host_queues(shost); + return count; }