Compare commits

..

No commits in common. "f630bf5f181fdb6aa04e3aa59c33436d6e216f6e" and "eaf36c0cd6fe80753e8ff3eeb4de8aabd5c5dc03" have entirely different histories.

5 changed files with 1 additions and 230 deletions

View File

@ -1,44 +0,0 @@
From c7e995c8a4a3985d1b315814d29e8d9211d6dc5e Mon Sep 17 00:00:00 2001
From: lixiaokeng <lixiaokeng@huawei.com>
Date: Tue, 30 Nov 2021 16:38:02 +0800
Subject: [PATCH 1/2] fix coredump in bl_add_disk
The serial->data is not malloced separately, so it can't be freed.
Just free(serial).
Signed-off-by: Lixiaokeng <lixiaokeng@huawei.com>
---
utils/blkmapd/device-discovery.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
index f5f9b10..2c50205 100644
--- a/utils/blkmapd/device-discovery.c
+++ b/utils/blkmapd/device-discovery.c
@@ -188,7 +188,6 @@ static void bl_add_disk(char *filepath)
if (disk && diskpath) {
if (serial) {
- free(serial->data);
free(serial);
}
return;
@@ -229,7 +228,6 @@ static void bl_add_disk(char *filepath)
disk->valid_path = path;
}
if (serial) {
- free(serial->data);
free(serial);
}
}
@@ -242,7 +240,6 @@ static void bl_add_disk(char *filepath)
free(path);
}
if (serial) {
- free(serial->data);
free(serial);
}
return;
--
2.26.1.windows.1

View File

@ -1,35 +0,0 @@
From 2d1df7efe8e178721be9177e8ee0622e29991950 Mon Sep 17 00:00:00 2001
From: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Date: Sat, 29 Jan 2022 14:40:18 +0800
Subject: [PATCH] nfs-utils: set use-gss-proxy=1 to enable gss-proxy by default
In commit 104f90f4ce ('gssd: Introduce use-gss-proxy boolean to nfs.conf'),
use-gss-proxy par in [gssd] section of nfs.conf is introduced to
allow the used of the gssprox-mech. However, the default value
of use-gss-proxy is false, which cause different behavor with older
version.
In order to be consistent with the old versions, here we set
use-gss-proxy to true in nfs.conf.
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
---
nfs.conf | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/nfs.conf b/nfs.conf
index 186a5b1..955abea 100644
--- a/nfs.conf
+++ b/nfs.conf
@@ -16,7 +16,7 @@
# rpc-verbosity=0
# use-memcache=0
# use-machine-creds=1
-# use-gss-proxy=0
+use-gss-proxy=1
# avoid-dns=1
# limit-to-legacy-enctypes=0
# context-timeout=0
--
1.8.3.1

View File

@ -1,35 +0,0 @@
From 576d3569c025e829e4ce432103532fcf63808d39 Mon Sep 17 00:00:00 2001
From: zhanchengbin <zhanchengbin1@huawei.com>
Date: Tue, 6 Sep 2022 09:49:30 +0800
Subject: [PATCH] nfs-blkmaped: Fix the error status when nfs_blkmapd stops
The systemctl stop nfs-blkmap.service will sends the SIGTERM signal
to the nfs-blkmap.service first.If the process fails to be stopped,
it sends the SIGKILL signal again to kill the process.
However, exit(1) is executed in the SIGTERM processing function of
nfs-blkmap.service. As a result, systemd receives an error message
indicating that nfs-blkmap.service failed.
"Active: failed" is displayed when the systemctl status
nfs-blkmap.service command is executed.
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
---
utils/blkmapd/device-discovery.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
index 77ebe73..8ca548c 100644
--- a/utils/blkmapd/device-discovery.c
+++ b/utils/blkmapd/device-discovery.c
@@ -462,7 +462,7 @@ static void sig_die(int signal)
unlink(PID_FILE);
}
BL_LOG_ERR("exit on signal(%d)\n", signal);
- exit(1);
+ exit(0);
}
static void usage(void)
{
--
1.8.3.1

View File

@ -1,94 +0,0 @@
From 9565ab64e60f8282967e138f43c6057562dc5c27 Mon Sep 17 00:00:00 2001
From: zhanchengbin <zhanchengbin1@huawei.com>
Date: Sat, 19 Nov 2022 11:50:07 -0500
Subject: [PATCH] nfs-blkmapd: PID file read by systemd failed
When started nfs-blkmap.service, the PID file can't be opened, The
cause is that the child process does not create the PID file before
the systemd reads the PID file.
Adding "ExecStartPost=/bin/sleep 0.1" to
/usr/lib/systemd/system/nfs-blkmap.service will probably solve this
problem, However, there is no guarantee that the above solutions are
effective under high cpu pressure.So replace the daemon function with
the fork function, and put the behavior of creating the PID file in
the parent process to solve the above problems.
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
Signed-off-by: Steve Dickson <steved@redhat.com>
---
utils/blkmapd/device-discovery.c | 48 ++++++++++++++++++++++++++--------------
1 file changed, 32 insertions(+), 16 deletions(-)
diff --git a/utils/blkmapd/device-discovery.c b/utils/blkmapd/device-discovery.c
index bd89059..a565fdb 100644
--- a/utils/blkmapd/device-discovery.c
+++ b/utils/blkmapd/device-discovery.c
@@ -504,28 +504,44 @@ int main(int argc, char **argv)
if (fg) {
openlog("blkmapd", LOG_PERROR, 0);
} else {
- if (daemon(0, 0) != 0) {
- fprintf(stderr, "Daemonize failed\n");
- exit(1);
+ pid_t pid = fork();
+ if (pid < 0) {
+ BL_LOG_ERR("fork error\n");
+ exit(1);
+ } else if (pid != 0) {
+ pidfd = open(PID_FILE, O_WRONLY | O_CREAT, 0644);
+ if (pidfd < 0) {
+ BL_LOG_ERR("Create pid file %s failed\n", PID_FILE);
+ exit(1);
+ }
+
+ if (lockf(pidfd, F_TLOCK, 0) < 0) {
+ BL_LOG_ERR("Already running; Exiting!");
+ close(pidfd);
+ exit(1);
+ }
+ if (ftruncate(pidfd, 0) < 0)
+ BL_LOG_ERR("ftruncate on %s failed: m\n", PID_FILE);
+ sprintf(pidbuf, "%d\n", pid);
+ if (write(pidfd, pidbuf, strlen(pidbuf)) != (ssize_t)strlen(pidbuf))
+ BL_LOG_ERR("write on %s failed: m\n", PID_FILE);
+ exit(0);
+ }
+
+ (void)setsid();
+ if (chdir("/")) {
+ BL_LOG_ERR("chdir error\n");
+ }
+ int fd = open("/dev/null", O_RDWR, 0);
+ if (fd >= 0) {
+ (void)dup2(fd, STDIN_FILENO);
+ (void)dup2(fd, STDOUT_FILENO);
+ (void)dup2(fd, STDERR_FILENO);
+
+ (void)close(fd);
}
openlog("blkmapd", LOG_PID, 0);
- pidfd = open(PID_FILE, O_WRONLY | O_CREAT, 0644);
- if (pidfd < 0) {
- BL_LOG_ERR("Create pid file %s failed\n", PID_FILE);
- exit(1);
- }
-
- if (lockf(pidfd, F_TLOCK, 0) < 0) {
- BL_LOG_ERR("Already running; Exiting!");
- close(pidfd);
- exit(1);
- }
- if (ftruncate(pidfd, 0) < 0)
- BL_LOG_WARNING("ftruncate on %s failed: m\n", PID_FILE);
- sprintf(pidbuf, "%d\n", getpid());
- if (write(pidfd, pidbuf, strlen(pidbuf)) != (ssize_t)strlen(pidbuf))
- BL_LOG_WARNING("write on %s failed: m\n", PID_FILE);
}
signal(SIGINT, sig_die);
--
2.27.0

View File

@ -4,7 +4,7 @@
Name: nfs-utils
Version: 2.5.1
Release: 8
Release: 3
Epoch: 1
Summary: The Linux NFS userland utility package
License: MIT and GPLv2 and GPLv2+ and BSD
@ -14,10 +14,6 @@ Source0: https://www.kernel.org/pub/linux/utils/nfs-utils/%{version}/%{name}-%{v
Patch0: 0000-systemd-idmapd-require-rpc-pipefs.patch
Patch1: 0001-correct-the-statd-path-in-man.patch
Patch2: 0002-fix-coredump-in-bl_add_disk.patch
Patch3: 0003-nfs-utils-set-use-gss-proxy-1-to-enable-gss-proxy-by.patch
Patch4: 0004-nfs-blkmaped-Fix-the-error-status-when-nfs_blkmapd-s.patch
Patch5: 0005-nfs-blkmapd-PID-file-read-by-systemd-failed.patch
BuildRequires: libevent-devel,libcap-devel, libtirpc-devel libblkid-devel
BuildRequires: krb5-libs >= 1.4 autoconf >= 2.57 openldap-devel >= 2.2
@ -226,23 +222,6 @@ fi
%{_mandir}/*/*
%changelog
* Thu Nov 24 2022 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 1:2.5.1-8
- nfs-blkmapd: PID file read by systemd failed
* Tue Sep 6 2022 zhanchengbin <zhanchengbin@huawei.com> - 1:2.5.1-7
- nfs-blkmaped: Fix the error status when nfs_blkmapd stops
* Fri Jul 1 2022 liwenchong <liwenchong@kylinos.cn> - 1:2.5.1-6
- set use-gss-proxy to true in nfs.conf to be consistent with the
description of 0003-nfs-utils-set-use-gss-proxy-1-to-enable-gss-proxy-by.patch
* Sat Jan 29 2022 Zhiqiang Liu <liuzhiqiang26@huawei.com> - 2.5.1-5
- In order to be consistent with the old versions, here we set
use-gss-proxy to true in nfs.conf.
* Tue Nov 30 2021 yanglongkang <yanglongkang@huawei.com> - 2.5.1-4
- fix nfs-blkmapd service core dump
* Wed Nov 11 2020 lixiaokeng <lixiaokeng@huawei.com> - 2.5.1-3
- add epoch to the version of help package required