Received: by 2002:a05:7412:3210:b0:e2:908c:2ebd with SMTP id eu16csp1193078rdb; Fri, 1 Sep 2023 16:19:57 -0700 (PDT) X-Google-Smtp-Source: AGHT+IG2fqu75g7PEMCBOHtg+zJsOhriA23+BNWgyUWt0rDRe2i5HYaYgKNZ240f30wnGz4gjehH X-Received: by 2002:a2e:9d99:0:b0:2bc:f60c:445f with SMTP id c25-20020a2e9d99000000b002bcf60c445fmr2520455ljj.36.1693610397144; Fri, 01 Sep 2023 16:19:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1693610397; cv=none; d=google.com; s=arc-20160816; b=chJAN2HgqtnSM1Hfm5TSFnGS2i2FeoGjEBYuhUJUygAsoK4eO+WpxuYVJPs6GLLUWh cU6/uuMZaeHRQlkVmlJLwOF6z/f7L0GpSWCDSyQ924v3DAVMzsQwRn0fv1FrE1WpmEzk jUzdRrr1FFXG4K2u2yHO0W8Dv8hx359kHmVFu+x5YCWaMmi1EsQ97Uh9nAEdz1qUa6Cg 5SssPH73Xj6nTcvbrLTKyEJe+U9GoKpj3SZ2dOu5uOUPgnPwjRIaB5J946RagybHSr66 iqyNGzteA+WbHq2gHqzyy0bPUCvBKh4GhY6JUcjEaKASiNdmV55t0hCQed+xGhe/wZ9d TSeQ== 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=mfTvl+BMV2v6aLSZaCevZ/QAvd93kZVhqM4cwxV8JBw=; fh=U8QwZ5xHaU2/8ln497S/E2sKzHGkM9mdrpYdmq3DJOs=; b=Z33fMIdX5cMtlRGe55DyvRrj10fvZ0fU1HJm4+tIZOPtXytrOlZ4MC6/G76hjkkC/7 8TYsms3FjbC5d9Zzlj6MP0N9i9YlRAyIeXxVHKBameeimJC8+Wgm1M9V4f+Gu9iDmgTS QMya2n09XKmcfck4T5q/KC0jonDTvUtJoSw93jKFjwXrq3fs2BrD4xqT2rXkgp3W7jKz sqE+HVs5e7UVnbQafpobGC13xV9d2+TTcwfMFxmQvS2AYzJK7cCTWxu8N5LQKD2zCtkA 8p6UrKyK6EmxVqR3R01wz0HyE2lIswC2WXxAeV2TEDGDQ1QNOVCyArxyhDbmTasjwzXx en8Q== 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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k23-20020a170906a39700b0099d74066201si3006511ejz.415.2023.09.01.16.19.22; Fri, 01 Sep 2023 16:19:57 -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; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232879AbjIAJn2 (ORCPT + 99 others); Fri, 1 Sep 2023 05:43:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349043AbjIAJm7 (ORCPT ); Fri, 1 Sep 2023 05:42:59 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE8141BE3; Fri, 1 Sep 2023 02:42:30 -0700 (PDT) Received: from kwepemm600012.china.huawei.com (unknown [172.30.72.55]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4RcXyd20CjzhZJn; Fri, 1 Sep 2023 17:38:17 +0800 (CST) Received: from build.huawei.com (10.175.101.6) by kwepemm600012.china.huawei.com (7.193.23.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.31; Fri, 1 Sep 2023 17:42:10 +0800 From: Wenchao Hao To: "James E . J . Bottomley" , "Martin K . Petersen" , CC: Hannes Reinecke , , , , Wenchao Hao Subject: [RFC PATCH v2 19/19] scsi: iscsi_tcp: Add param to control LUN based error handle Date: Fri, 1 Sep 2023 17:41:27 +0800 Message-ID: <20230901094127.2010873-20-haowenchao2@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20230901094127.2010873-1-haowenchao2@huawei.com> References: <20230901094127.2010873-1-haowenchao2@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems702-chm.china.huawei.com (10.3.19.179) To kwepemm600012.china.huawei.com (7.193.23.74) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 Add new param lun_eh to control if enable LUN based error handler, since iscsi_tcp defined callback eh_target_reset, so make it fallback to further recover when LUN based recovery can not recover all error commands. Signed-off-by: Wenchao Hao --- drivers/scsi/iscsi_tcp.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index 9ab8555180a3..83474dc0ecd5 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include @@ -63,6 +64,10 @@ module_param_named(debug_iscsi_tcp, iscsi_sw_tcp_dbg, int, MODULE_PARM_DESC(debug_iscsi_tcp, "Turn on debugging for iscsi_tcp module " "Set to 1 to turn on, and zero to turn off. Default is off."); +static bool iscsi_sw_tcp_lun_eh; +module_param_named(lun_eh, iscsi_sw_tcp_lun_eh, bool, 0444); +MODULE_PARM_DESC(lun_eh, "LUN based error handle (def=0)"); + #define ISCSI_SW_TCP_DBG(_conn, dbg_fmt, arg...) \ do { \ if (iscsi_sw_tcp_dbg) \ @@ -1065,6 +1070,19 @@ static int iscsi_sw_tcp_slave_configure(struct scsi_device *sdev) return 0; } +static int iscsi_sw_tcp_slave_alloc(struct scsi_device *sdev) +{ + if (iscsi_sw_tcp_lun_eh) + return scsi_device_setup_eh(sdev, 1); + return 0; +} + +static void iscsi_sw_tcp_slave_destroy(struct scsi_device *sdev) +{ + if (iscsi_sw_tcp_lun_eh) + return scsi_device_clear_eh(sdev); +} + static const struct scsi_host_template iscsi_sw_tcp_sht = { .module = THIS_MODULE, .name = "iSCSI Initiator over TCP/IP", @@ -1080,6 +1098,8 @@ static const struct scsi_host_template iscsi_sw_tcp_sht = { .eh_target_reset_handler = iscsi_eh_recover_target, .dma_boundary = PAGE_SIZE - 1, .slave_configure = iscsi_sw_tcp_slave_configure, + .slave_alloc = iscsi_sw_tcp_slave_alloc, + .slave_destroy = iscsi_sw_tcp_slave_destroy, .proc_name = "iscsi_tcp", .this_id = -1, .track_queue_depth = 1, -- 2.35.3