From patchwork Fri Dec 2 03:58:30 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 9457773 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E67256074E for ; Fri, 2 Dec 2016 04:00:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DBC7E28489 for ; Fri, 2 Dec 2016 04:00:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D08A128505; Fri, 2 Dec 2016 04:00: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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 76F5328489 for ; Fri, 2 Dec 2016 04:00:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752976AbcLBEAG (ORCPT ); Thu, 1 Dec 2016 23:00:06 -0500 Received: from mx2.suse.de ([195.135.220.15]:36576 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752480AbcLBEAG (ORCPT ); Thu, 1 Dec 2016 23:00:06 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 11492AAA3; Fri, 2 Dec 2016 04:00:05 +0000 (UTC) From: NeilBrown To: "J. Bruce Fields" , Steve Dickson Date: Fri, 02 Dec 2016 14:58:30 +1100 Subject: [PATCH 13/15] statd: allow --no-notify to be passed via environment variable. Cc: linux-nfs@vger.kernel.org Message-ID: <148065111006.28046.16308993928673129470.stgit@noble> In-Reply-To: <148065078775.28046.5506130555300891075.stgit@noble> References: <148065078775.28046.5506130555300891075.stgit@noble> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The significant value of allowing this is that it means that for default operation, systemd unit files do not need to pass any options to any programs. The purpose of this will become apparent in the next patch. Signed-off-by: NeilBrown --- systemd/rpc-statd.service | 3 ++- utils/statd/statd.c | 5 +++++ utils/statd/statd.man | 5 +++++ 3 files changed, 12 insertions(+), 1 deletion(-) -- To unsubscribe from this list: send the line "unsubscribe linux-nfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/systemd/rpc-statd.service b/systemd/rpc-statd.service index a02f5c41a424..d5392b7cff4d 100644 --- a/systemd/rpc-statd.service +++ b/systemd/rpc-statd.service @@ -11,7 +11,8 @@ Wants=nfs-config.service After=nfs-config.service [Service] +Environment=RPC_STATD_NO_NOTIFY=1 EnvironmentFile=-/run/sysconfig/nfs-utils Type=forking PIDFile=/var/run/rpc.statd.pid -ExecStart=/usr/sbin/rpc.statd --no-notify $STATDARGS +ExecStart=/usr/sbin/rpc.statd $STATDARGS diff --git a/utils/statd/statd.c b/utils/statd/statd.c index 5f4ad79e6bf3..1c34c9ef02cb 100644 --- a/utils/statd/statd.c +++ b/utils/statd/statd.c @@ -251,10 +251,15 @@ int main (int argc, char **argv) int nlm_udp = 0, nlm_tcp = 0; struct rlimit rlim; int notify_sockfd; + char *env; /* Default: daemon mode, no other options */ run_mode = 0; + env = getenv("RPC_STATD_NO_NOTIFY"); + if (env && atoi(env) > 0) + run_mode |= MODE_NO_NOTIFY; + /* Log to stderr if there's an error during startup */ xlog_stderr(1); xlog_syslog(0); diff --git a/utils/statd/statd.man b/utils/statd/statd.man index 91c260f1bf5e..71d58461b5ea 100644 --- a/utils/statd/statd.man +++ b/utils/statd/statd.man @@ -418,6 +418,11 @@ it attempts to start listeners on network transports marked 'visible' in As long as at least one network transport listener starts successfully, .B rpc.statd will operate. +.SH ENVIRONMENT +.TP +.B RPC_STATD_NO_NOTIFY= +If set to a positive integer, has the same effect as +.IR \-\-no\-notify . .SH FILES .TP 2.5i .I /var/lib/nfs/sm