From patchwork Fri Dec 2 03:58:29 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: NeilBrown X-Patchwork-Id: 9457757 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 261176074E for ; Fri, 2 Dec 2016 03:59:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AE0528489 for ; Fri, 2 Dec 2016 03:59:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0FE0828505; Fri, 2 Dec 2016 03:59:27 +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 A1ABD28489 for ; Fri, 2 Dec 2016 03:59:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751963AbcLBD7Z (ORCPT ); Thu, 1 Dec 2016 22:59:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:36452 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751164AbcLBD7Z (ORCPT ); Thu, 1 Dec 2016 22:59:25 -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 19691AAA3; Fri, 2 Dec 2016 03:59:24 +0000 (UTC) From: NeilBrown To: "J. Bruce Fields" , Steve Dickson Date: Fri, 02 Dec 2016 14:58:29 +1100 Subject: [PATCH 06/15] Add /etc/nfs.conf support for sm-notify Cc: linux-nfs@vger.kernel.org Message-ID: <148065110892.28046.18251782958732101170.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 Signed-off-by: NeilBrown --- systemd/nfs.conf.man | 10 ++++++++++ utils/statd/sm-notify.c | 11 +++++++++++ utils/statd/sm-notify.man | 27 +++++++++++++++++++++++++++ 3 files changed, 48 insertions(+) -- 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/nfs.conf.man b/systemd/nfs.conf.man index a1121e46ef5e..726f603544b7 100644 --- a/systemd/nfs.conf.man +++ b/systemd/nfs.conf.man @@ -142,6 +142,16 @@ See .BR rpc.statd (8) for details. +.TP +.B sm-notify +Recognized values: +.BR retry-time , +.BR outgoing-port ", and" +.BR outgoing-addr . + +See +.BR sm-notify (8) +for details. .SH FILES .I /etc/nfs.conf diff --git a/utils/statd/sm-notify.c b/utils/statd/sm-notify.c index 8afddd97da73..19f40afcb376 100644 --- a/utils/statd/sm-notify.c +++ b/utils/statd/sm-notify.c @@ -29,6 +29,7 @@ #include #include +#include "conffile.h" #include "sockaddr.h" #include "xlog.h" #include "nsm.h" @@ -66,6 +67,7 @@ static _Bool opt_update_state = true; static unsigned int opt_max_retry = 15 * 60; static char * opt_srcaddr = NULL; static char * opt_srcport = NULL; +char * conf_path = NFS_CONFFILE; static void notify(const int sock); static int notify_host(int, struct nsm_host *); @@ -479,6 +481,7 @@ main(int argc, char **argv) { int c, sock, force = 0; char * progname; + char * s; progname = strrchr(argv[0], '/'); if (progname != NULL) @@ -486,6 +489,14 @@ main(int argc, char **argv) else progname = argv[0]; + conf_init(); + opt_max_retry = conf_get_num("sm-notify", "retry-time", opt_max_retry / 60) * 60; + opt_srcport = conf_get_str("sm-notify", "outgoing-port"); + opt_srcaddr = conf_get_str("sm-notify", "outgoing-addr"); + s = conf_get_str("statd", "state-directory-path"); + if (s && !nsm_setup_pathnames(argv[0], s)) + exit(1); + while ((c = getopt(argc, argv, "dm:np:v:P:f")) != -1) { switch (c) { case 'f': diff --git a/utils/statd/sm-notify.man b/utils/statd/sm-notify.man index 7a1cbfae998f..bb7f6e0a1420 100644 --- a/utils/statd/sm-notify.man +++ b/utils/statd/sm-notify.man @@ -219,6 +219,33 @@ argument when sending SM_NOTIFY requests. .IP This option can be useful in multi-homed configurations where the remote requires notification from a specific network address. +.SH CONFIGURATION FILE +Many of the options that can be set on the command line can also be +controlled through values set in the +.B [sm-notify] +or, in one case, the +.B [statd] +section of the +.I /etc/nfs.conf +configuration file. + +Values recognized in the +.B [sm-notify] +section include: +.BR retry-time , +.BR outgoing-port ", and" +.BR outgoing-addr . +These have the same effect as the command line options +.BR m , +.BR p ", and" +.B v +respectively. + +The value recognized in the +.B [statd] +section is +.BR state-directory-path . + .SH SECURITY The .B sm-notify