From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.7 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 52C0AC433E7 for ; Fri, 28 Aug 2020 09:51:15 +0000 (UTC) Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 2FFE8208D5 for ; Fri, 28 Aug 2020 09:51:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2FFE8208D5 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.de Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-nvdimm-bounces@lists.01.org Received: from ml01.vlan13.01.org (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 1B3A5128BF5BC; Fri, 28 Aug 2020 02:51:15 -0700 (PDT) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=195.135.220.15; helo=mx2.suse.de; envelope-from=msuchanek@suse.de; receiver= Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id DF3BF128A7AD1 for ; Fri, 28 Aug 2020 02:51:12 -0700 (PDT) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 2B401AC5E; Fri, 28 Aug 2020 09:51:44 +0000 (UTC) From: Michal Suchanek To: linux-nvdimm@lists.01.org Subject: [PATCH 2/3] ndctl/namespace: Suppress -ENXIO when processing all namespaces. Date: Fri, 28 Aug 2020 11:51:04 +0200 Message-Id: <17d792c9efe8de3b196ed6a46e3af03c2c176fa3.1598608222.git.msuchanek@suse.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: References: MIME-Version: 1.0 Message-ID-Hash: GS2OET4NIVF2F45X6LJQRBQZ5PIF3E5R X-Message-ID-Hash: GS2OET4NIVF2F45X6LJQRBQZ5PIF3E5R X-MailFrom: msuchanek@suse.de X-Mailman-Rule-Hits: nonmember-moderation X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation CC: Michal Suchanek , Harish Sriram X-Mailman-Version: 3.1.1 Precedence: list List-Id: "Linux-nvdimm developer list." Archived-At: List-Archive: List-Help: List-Post: List-Subscribe: List-Unsubscribe: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit When processing all namespaces and no namespaces exist user gets the default -ENXIO. Set default rc to 0 when processing all namespaces. This avoids confusing error message printed in addition to the message saying 0 namespaces were affected. Before: # ndctl check-namespace all namespace0.0: namespace_check: namespace0.0: check aborted, namespace online error checking namespaces: Device or resource busy checked 0 namespaces # ndctl disable-namespace all disabled 1 namespace # ndctl check-namespace all namespace0.0: namespace_check: Unable to recover any BTT info blocks error checking namespaces: No such device or address checked 0 namespaces # ndctl destroy-namespace all destroyed 1 namespace # ndctl check-namespace all error checking namespaces: No such device or address checked 0 namespaces # ndctl destroy-namespace all error destroying namespaces: No such device or address destroyed 0 namespaces After: # ndctl check-namespace all namespace0.0: namespace_check: namespace0.0: check aborted, namespace online error checking namespaces: Device or resource busy checked 0 namespaces # ndctl disable-namespace namespace0.0 disabled 1 namespace # ndctl check-namespace all namespace0.0: namespace_check: Unable to recover any BTT info blocks error checking namespaces: No such device or address checked 0 namespaces # ndctl destroy-namespace all destroyed 1 namespace # ndctl check-namespace all checked 0 namespaces # ndctl destroy-namespace all destroyed 0 namespaces # ndctl destroy-namespace all destroyed 0 namespaces Note: this does change the return value from -ENXIO to 0 in the cases when no namespaces exist and processing all namespaces was requested. Link: https://patchwork.kernel.org/patch/11681431/ Signed-off-by: Michal Suchanek Reviewed-by: Santosh S --- v2: fix the error code references in the commit message --- ndctl/namespace.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/ndctl/namespace.c b/ndctl/namespace.c index 3fabe4799d75..835f4076008a 100644 --- a/ndctl/namespace.c +++ b/ndctl/namespace.c @@ -2112,6 +2112,9 @@ static int do_xaction_namespace(const char *namespace, if (!namespace && action != ACTION_CREATE) return rc; + if (namespace && (strcmp(namespace, "all") == 0)) + rc = 0; + if (verbose) ndctl_set_log_priority(ctx, LOG_DEBUG); -- 2.28.0 _______________________________________________ Linux-nvdimm mailing list -- linux-nvdimm@lists.01.org To unsubscribe send an email to linux-nvdimm-leave@lists.01.org