Received: by 2002:a05:7412:2a8c:b0:e2:908c:2ebd with SMTP id u12csp2924950rdh; Wed, 27 Sep 2023 18:13:30 -0700 (PDT) X-Google-Smtp-Source: AGHT+IE4XG92pkO985QkavYX0r1Gq41V+/ZuoNKlTPqL8FcKFsea41ldER6hNEyv0PSiaz2O2sVm X-Received: by 2002:a81:a0d0:0:b0:59f:4bea:512f with SMTP id x199-20020a81a0d0000000b0059f4bea512fmr4028783ywg.15.1695863610579; Wed, 27 Sep 2023 18:13:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695863610; cv=none; d=google.com; s=arc-20160816; b=m+EHQCCsJJT/stG/IQiuN8Z5+p966JQtiEwJtFI93vjYHdPSEJ471PhGLL40R81k3e lbZyxjk+qWysvlVQ0pKkKKMU+0sO0K0feFFqFoHI+iCPo4ghjAR/3f9L0tVEhnTUiU0C Hi4bR/qGXsKf4Grlcv4b/Suut+A2mx3VQI1U/ObWABb5o3sKkfeljbin6czgMgKH3EKu CEvLDkhTsf3nZR3twoY5q7P/Zy9F5VxXwmk5VfJncPwXwl7N8kmC+MlSwV3UHVhAhh1I lkxTLG3AdBvUkVWRnHaktIRXGZ3giol5Ph7jTCG7Ss0L94K//HXpObhSI9zuYLsVBWQ6 qXGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:reply-to:user-agent :mime-version:date:message-id; bh=kg4rRosN0oSrWVIYWcwrIkeL/OFCZbyt1Mc4XxbJyGk=; fh=UEpFMKOqyweapDowiE7VvOt2ySza3HVObMQ+Ezn7xQ0=; b=qKF4h4kG6VtwyC/kPeHD5DD736cMLQZjCDjSD7j2TAIWDG8Ttpy3Cf9KO6kQfvj37E qJ7nocjlxMFDrqi4+w1I66fp9fIbYtbJLati6E3qg/gSV75qnblWaC8oi8BJUtxi+rv0 CSj2myxrXxj26G5jwe0pv5J6PKd3qPMYKjCstnSB34OCL8ZYfJvwNj0ttjPNhgB5D49T f9PN7o2o5NC6srEgmAYpXj/iej3oHiscGNOhsDydjYGCfgSihTIfrL1sQ+9rO+sSGRYb DdWOTZQSLFS30B0IxJoeTna/+Oee/CkT65KHlLSFySX2hkDUMypCcWkG+ZxILDI5vEUQ dkLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [2620:137:e000::3:3]) by mx.google.com with ESMTPS id e20-20020a17090ac21400b0027766c98d00si8009857pjt.40.2023.09.27.18.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Sep 2023 18:13:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) client-ip=2620:137:e000::3:3; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:3 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 27F5B82922CF; Wed, 27 Sep 2023 18:13:28 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229869AbjI1BNP (ORCPT + 99 others); Wed, 27 Sep 2023 21:13:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229437AbjI1BNO (ORCPT ); Wed, 27 Sep 2023 21:13:14 -0400 Received: from mp-relay-02.fibernetics.ca (mp-relay-02.fibernetics.ca [208.85.217.137]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 107DEBF for ; Wed, 27 Sep 2023 18:13:13 -0700 (PDT) Received: from mailpool-fe-01.fibernetics.ca (mailpool-fe-01.fibernetics.ca [208.85.217.144]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mp-relay-02.fibernetics.ca (Postfix) with ESMTPS id BF92876AA1; Thu, 28 Sep 2023 01:13:09 +0000 (UTC) Received: from localhost (mailpool-mx-01.fibernetics.ca [208.85.217.140]) by mailpool-fe-01.fibernetics.ca (Postfix) with ESMTP id B269A457E4; Thu, 28 Sep 2023 01:13:09 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at X-Spam-Score: -0.199 X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 Received: from mailpool-fe-01.fibernetics.ca ([208.85.217.144]) by localhost (mail-mx-01.fibernetics.ca [208.85.217.140]) (amavisd-new, port 10024) with ESMTP id kEFzXDrP3_UU; Thu, 28 Sep 2023 01:13:08 +0000 (UTC) Received: from [192.168.48.17] (host-104-157-209-188.dyn.295.ca [104.157.209.188]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: dgilbert@interlog.com) by mail.ca.inter.net (Postfix) with ESMTPSA id A4F4F457E2; Thu, 28 Sep 2023 01:13:06 +0000 (UTC) Message-ID: <8c7cfe09-d145-4387-91cf-da9d4e2398e1@interlog.com> Date: Wed, 27 Sep 2023 21:13:05 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Reply-To: dgilbert@interlog.com Subject: Re: [PATCH v5 01/10] scsi: scsi_debug: create scsi_debug directory in the debugfs filesystem Content-Language: en-CA To: Wenchao Hao , "James E . J . Bottomley" , "Martin K . Petersen" , open-iscsi@googlegroups.com, linux-scsi@vger.kernel.org Cc: linux-kernel@vger.kernel.org, louhongxiang@huawei.com References: <20230922092906.2645265-1-haowenchao2@huawei.com> <20230922092906.2645265-2-haowenchao2@huawei.com> From: Douglas Gilbert In-Reply-To: <20230922092906.2645265-2-haowenchao2@huawei.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Wed, 27 Sep 2023 18:13:28 -0700 (PDT) On 2023-09-22 05:28, Wenchao Hao wrote: > Create directory scsi_debug in the root of the debugfs filesystem. > Prepare to add interface for manage error injection. > > Acked-by: Douglas Gilbert > Signed-off-by: Wenchao Hao > --- > drivers/scsi/scsi_debug.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/scsi/scsi_debug.c b/drivers/scsi/scsi_debug.c > index 9c0af50501f9..35c336271b13 100644 > --- a/drivers/scsi/scsi_debug.c > +++ b/drivers/scsi/scsi_debug.c > @@ -41,6 +41,7 @@ > #include > #include > #include > +#include > > #include > > @@ -862,6 +863,8 @@ static const int device_qfull_result = > > static const int condition_met_result = SAM_STAT_CONDITION_MET; > > +static struct dentry *sdebug_debugfs_root; > + > > /* Only do the extra work involved in logical block provisioning if one or > * more of the lbpu, lbpws or lbpws10 parameters are given and we are doing > @@ -7011,6 +7014,8 @@ static int __init scsi_debug_init(void) > goto driver_unreg; > } > > + sdebug_debugfs_root = debugfs_create_dir("scsi_debug", NULL); debugfs_create_dir() can fail and return NULL. Looking at other drivers, most seem to assume it will work. Since the scsi_debug driver is often used to test abnormal situations, perhaps adding something like: if (!sdebug_debugfs_root) pr_info("%s: failed to create initial debugfs directory\n", __func__); might save someone a bit of time if a NULL dereference on sdebug_debugfs_root follows later. That is what the mpt3sas driver does. Doug Gilbert > + > for (k = 0; k < hosts_to_add; k++) { > if (want_store && k == 0) { > ret = sdebug_add_host_helper(idx); > @@ -7057,6 +7062,7 @@ static void __exit scsi_debug_exit(void) > > sdebug_erase_all_stores(false); > xa_destroy(per_store_ap); > + debugfs_remove(sdebug_debugfs_root); > } > > device_initcall(scsi_debug_init);