- Delete 0006-nfs.conf-silence-include-error.patch

replaced with better version
- 0006-conffile-allow-optional-include-files.patch
   Avoid error if /etc/nfs.conf.local doesn't exist
  (bsc#1151044 bsc#1150807)
- 0008-mountd-Initialize-logging-early.patch
 Don't close the loging socket - it causes problems.
  (bsc#1151044 bsc#1150807)

OBS-URL: https://build.opensuse.org/package/show/Base:System/nfs-utils?expand=0&rev=208
This commit is contained in:
Neil Brown 2019-09-23 02:09:16 +00:00 committed by Git OBS Bridge
parent 0138b6c771
commit c4424eaa19
6 changed files with 138 additions and 31 deletions

View File

@ -0,0 +1,61 @@
From f608217f6136c0e9fedc7bc728e4ba13ed295c4c Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Mon, 23 Sep 2019 11:20:39 +1000
Subject: [PATCH] conffile: allow optional include files.
If nfs.conf contains, for example
include = /etc/nfs.conf.local
and /etc/nfs.conf.local doesn't exist, then a warning is given.
Sometimes it is useful to have an optional include file which is
included if present, but for which an absence doesn't give a
warning.
Systemd has a convention that a hyphen at the start of
an include file name marks it as optional, so add this convention
to nfs-utils.
So
include = -/etc/nfs.conf.local
will not give a warning if the file doesn't exist.
Signed-off-by: NeilBrown <neilb@suse.de>
---
support/nfs/conffile.c | 13 ++++++++++---
systemd/nfs.conf.man | 3 +++
2 files changed, 13 insertions(+), 3 deletions(-)
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -413,11 +413,18 @@ conf_parse_line(int trans, char *line, c
if (strcasecmp(line, "include")==0) {
/* load and parse subordinate config files */
+ _Bool optional = false;
+
+ if (val && *val == '-') {
+ optional = true;
+ val++;
+ }
+
relpath = relative_path(filename, val);
if (relpath == NULL) {
- xlog_warn("config error at %s:%d: "
- "error loading included config",
- filename, lineno);
+ if (!optional)
+ xlog_warn("config error at %s:%d: error loading included config",
+ filename, lineno);
return;
}
--- a/systemd/nfs.conf.man
+++ b/systemd/nfs.conf.man
@@ -65,6 +65,9 @@ section headers, then new sections will
included file appeared in place of the
.B include
line.
+If the file name starts with a hyphen then that is stripped off
+before the file is opened, and if file doesn't exist no warning is
+given. Normally a non-existent include file generates a warning.
.PP
Lookup of section and value names is case-insensitive.

View File

@ -1,29 +0,0 @@
config: silence include error.
Including a non-existant file should not be an
error, and should not create a message.
We include /etc/nfs.conf.local just incase some
localization has been requested.
Signed-off-by: NeilBrown <neilb@suse.com>
---
support/nfs/conffile.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
--- a/support/nfs/conffile.c
+++ b/support/nfs/conffile.c
@@ -418,9 +418,10 @@ conf_parse_line(int trans, char *line, c
subconf = conf_readfile(relpath);
if (subconf == NULL) {
- xlog_warn("config error at %s:%d: "
- "error loading included config",
- filename, lineno);
+ // This warning is not helpful
+ //xlog_warn("config error at %s:%d: "
+ // "error loading included config",
+ // filename, lineno);
if (relpath)
free(relpath);
return;

View File

@ -0,0 +1,61 @@
From 30961f1bf9be6117aa825e7bfc8b327c93d3aacd Mon Sep 17 00:00:00 2001
From: NeilBrown <neilb@suse.de>
Date: Mon, 23 Sep 2019 11:10:31 +1000
Subject: [PATCH] mountd: Initialize logging early.
Reading the config file can generate log messages,
so we should initialize logging before reading the
config file.
If any log message are generated, syslog will leave
a file descriptor open (a socket), so calling
closeall(3) after this can cause problem.
Before this we initialize login we don't know if
Foreground (-F) has been selected, so closeall()
cannot be conditional on that.
closeall() isn't needed - daemon are almost always run
from a management daemon like systemd, and they are given
a clean environment. It is really best if they just take
what they are given.
So remove the closeall() call.
Signed-off-by: NeilBrown <neilb@suse.de>
---
utils/mountd/mountd.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
--- a/utils/mountd/mountd.c
+++ b/utils/mountd/mountd.c
@@ -679,6 +679,9 @@ main(int argc, char **argv)
else
progname = argv[0];
+ /* Initialize logging. */
+ xlog_open(progname);
+
conf_init_file(NFS_CONFFILE);
xlog_from_conffile("mountd");
manage_gids = conf_get_bool("mountd", "manage-gids", manage_gids);
@@ -818,9 +821,7 @@ main(int argc, char **argv)
}
}
}
- /* Initialize logging. */
if (!foreground) xlog_stderr(0);
- xlog_open(progname);
sa.sa_handler = SIG_IGN;
sa.sa_flags = 0;
@@ -832,10 +833,6 @@ main(int argc, char **argv)
/* WARNING: the following works on Linux and SysV, but not BSD! */
sigaction(SIGCHLD, &sa, NULL);
- /* Daemons should close all extra filehandles ... *before* RPC init. */
- if (!foreground)
- closeall(3);
-
cache_open();
unregister_services();

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Mon Sep 23 01:52:29 UTC 2019 - Neil Brown <nfbrown@suse.com>
- Delete 0006-nfs.conf-silence-include-error.patch
replaced with better version
- 0006-conffile-allow-optional-include-files.patch
Avoid error if /etc/nfs.conf.local doesn't exist
(bsc#1151044 bsc#1150807)
- 0008-mountd-Initialize-logging-early.patch
Don't close the loging socket - it causes problems.
(bsc#1151044 bsc#1150807)
-------------------------------------------------------------------
Mon Sep 16 23:43:37 UTC 2019 - Neil Brown <nfbrown@suse.com>

View File

@ -50,8 +50,9 @@ Patch2: 0002-Let-systemd-know-when-rpc.statd-is-needed.patch
Patch3: 0003-systemd-run-statd-notify-even-when-nfs-client-isn-t-.patch
Patch4: 0004-nfsidmap-honour-with-pluginpath-for-instalation.patch
Patch5: 0005-nfs.conf-fail-to-disable-major-NFS-version-4-using-v.patch
Patch6: 0006-nfs.conf-silence-include-error.patch
Patch6: 0006-conffile-allow-optional-include-files.patch
Patch7: 0007-statd-user-from-sm
Patch8: 0008-mountd-Initialize-logging-early.patch
BuildRequires: e2fsprogs-devel
BuildRequires: fedfs-utils-devel
@ -156,6 +157,7 @@ This package contains additional NFS documentation.
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
cp %{SOURCE6} .

View File

@ -9,7 +9,7 @@
[environment]
include = /etc/sysconfig/nfs
include = /etc/nfs.conf.local
include = -/etc/nfs.conf.local
[general]
pipefs-directory=$RPC_PIPEFS_DIR
#