From patchwork Fri Oct 5 00:00:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 10627017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BE34B1515 for ; Fri, 5 Oct 2018 00:01:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id ACD6C293C6 for ; Fri, 5 Oct 2018 00:01:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AB13D29504; Fri, 5 Oct 2018 00:01:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 64D45293C6 for ; Fri, 5 Oct 2018 00:01:07 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 376FD21A09130; Thu, 4 Oct 2018 17:01:07 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=vishal.l.verma@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 13F6921161B0A for ; Thu, 4 Oct 2018 17:01:05 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Oct 2018 17:01:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,342,1534834800"; d="scan'208";a="85853102" Received: from vverma7-desk1.lm.intel.com ([10.232.112.170]) by FMSMGA003.fm.intel.com with ESMTP; 04 Oct 2018 17:01:04 -0700 From: Vishal Verma To: Subject: [ndctl PATCH 1/2] ndctl, monitor: fix the severity of the "daemon started" message Date: Thu, 4 Oct 2018 18:00:56 -0600 Message-Id: <20181005000057.30186-1-vishal.l.verma@intel.com> X-Mailer: git-send-email 2.17.1 X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andreas Hasenack MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP The above message was printed as an error, but it is just an informational message. Change it to dbg(). Cc: QI Fuli Cc: Dan Williams Signed-off-by: Vishal Verma Reviewed-by: Dan Williams --- ndctl/monitor.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ndctl/monitor.c b/ndctl/monitor.c index d29e378..b44f946 100644 --- a/ndctl/monitor.c +++ b/ndctl/monitor.c @@ -660,7 +660,7 @@ int cmd_monitor(int argc, const char **argv, void *ctx) err((struct ndctl_ctx *)ctx, "daemon start failed\n"); goto out; } - err((struct ndctl_ctx *)ctx, "ndctl monitor daemon started\n"); + dbg((struct ndctl_ctx *)ctx, "ndctl monitor daemon started\n"); } if (parse_monitor_event(&monitor, (struct ndctl_ctx *)ctx)) From patchwork Fri Oct 5 00:00:57 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Verma, Vishal L" X-Patchwork-Id: 10627019 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A8C2D15E2 for ; Fri, 5 Oct 2018 00:01:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99CEE29504 for ; Fri, 5 Oct 2018 00:01:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 984FA29514; Fri, 5 Oct 2018 00:01:09 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from ml01.01.org (ml01.01.org [198.145.21.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 55AA42950D for ; Fri, 5 Oct 2018 00:01:09 +0000 (UTC) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id 4F9EC21162CA7; Thu, 4 Oct 2018 17:01:09 -0700 (PDT) X-Original-To: linux-nvdimm@lists.01.org Delivered-To: linux-nvdimm@lists.01.org Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.126; helo=mga18.intel.com; envelope-from=vishal.l.verma@intel.com; receiver=linux-nvdimm@lists.01.org Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 A22A221161B0A for ; Thu, 4 Oct 2018 17:01:07 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga106.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Oct 2018 17:01:07 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.54,342,1534834800"; d="scan'208";a="85853116" Received: from vverma7-desk1.lm.intel.com ([10.232.112.170]) by FMSMGA003.fm.intel.com with ESMTP; 04 Oct 2018 17:01:07 -0700 From: Vishal Verma To: Subject: [ndctl PATCH 2/2] ndctl, monitor: in daemon mode, exit successfully if no DIMMs are found Date: Thu, 4 Oct 2018 18:00:57 -0600 Message-Id: <20181005000057.30186-2-vishal.l.verma@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181005000057.30186-1-vishal.l.verma@intel.com> References: <20181005000057.30186-1-vishal.l.verma@intel.com> X-BeenThere: linux-nvdimm@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Linux-nvdimm developer list." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andreas Hasenack MIME-Version: 1.0 Errors-To: linux-nvdimm-bounces@lists.01.org Sender: "Linux-nvdimm" X-Virus-Scanned: ClamAV using ClamSMTP When we are running as a daemon, it is preferred to exit successfully when no DIMMs are found. When running in the foreground, retain an error return so that the user can be notified that nothing was found to monitor. In the longer term, replace this with a libudev uevent monitor that will look for DIMM addition/removal events, and update the running monitor(s) if the DIMMs match the active filter spec. Link: https://bugs.launchpad.net/ubuntu/+source/ndctl/+bug/1781268 Reported-by: Andreas Hasenack Cc: Dan Williams Cc: QI Fuli Signed-off-by: Vishal Verma Reviewed-by: Dan Williams --- ndctl/monitor.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ndctl/monitor.c b/ndctl/monitor.c index b44f946..7bf2ba7 100644 --- a/ndctl/monitor.c +++ b/ndctl/monitor.c @@ -681,8 +681,9 @@ int cmd_monitor(int argc, const char **argv, void *ctx) goto out; if (!mfa.num_dimm) { - err((struct ndctl_ctx *)ctx, "no dimms to monitor\n"); - rc = -ENXIO; + dbg((struct ndctl_ctx *)ctx, "no dimms to monitor\n"); + if (!monitor.daemon) + rc = -ENXIO; goto out; }