Compare commits

...

10 Commits

Author SHA1 Message Date
openeuler-ci-bot
f630bf5f18
!71 [sync] PR-68: nfs-blkmapd: PID file read by systemd failed
From: @openeuler-sync-bot 
Reviewed-by: @liuzhiqiang26 
Signed-off-by: @liuzhiqiang26
2022-11-25 07:00:05 +00:00
Zhiqiang Liu
fc4d156851 nfs-blkmapd: PID file read by systemd failed
fix issue:https://gitee.com/src-openeuler/nfs-utils/issues/I5TQQX

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
(cherry picked from commit 795a79f375980108ce10bcc80a0f99f159be5eec)
2022-11-25 09:13:50 +08:00
openeuler-ci-bot
d4ae7b1218
!59 [sync] PR-58: nfs-blkmaped: Fix the error status when nfs_blkmapd stops
From: @openeuler-sync-bot 
Reviewed-by: @liuzhiqiang26 
Signed-off-by: @liuzhiqiang26
2022-09-15 12:36:50 +00:00
zhanchengbin
6d3743b92d nfs-blkmaped: Fix the error status when nfs_blkmapd stops
Signed-off-by: zhanchengbin <zhanchengbin1@huawei.com>
(cherry picked from commit 5f5ffefed5db44588fdf01dc2ded564f4bbb3ee3)
2022-09-15 20:12:13 +08:00
openeuler-ci-bot
d9606ef651
!49 [sync] PR-48: nfs-utils:set use-gss-proxy to true in nfs.conf
From: @openeuler-sync-bot 
Reviewed-by: @liuzhiqiang26 
Signed-off-by: @liuzhiqiang26
2022-07-01 03:30:57 +00:00
kyliwenchong
453cffcccb nfs-utils: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
(cherry picked from commit 95005683dc6f4c8e06f3a928feeadd7d41c75738)
2022-07-01 09:58:57 +08:00
openeuler-ci-bot
1236384c1c
!31 [sync] PR-26: nfs-utils: set use-gss-proxy=1 to enable gss-proxy by default
From: @openeuler-sync-bot 
Reviewed-by: @liuzhiqiang26 
Signed-off-by: @liuzhiqiang26
2022-02-10 10:48:25 +00:00
Zhiqiang Liu
ca54b48bba 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.

Fix issue: https://gitee.com/src-openeuler/nfs-utils/issues/I4RUCG

Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
(cherry picked from commit 4b655089f71360b132b1d580c684e162081be223)
2022-02-10 17:17:44 +08:00
openeuler-ci-bot
3cc777c1de !21 fix nfs-blkmapd service core dump
From: @markeryang
Reviewed-by: @liuzhiqiang26
Signed-off-by: @liuzhiqiang26
2021-11-30 12:34:14 +00:00
markeryang
c0494a37be fix nfs-blkmapd service core dump 2021-11-30 19:43:52 +08:00
5 changed files with 230 additions and 1 deletions

View File

@ -0,0 +1,44 @@
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

@ -0,0 +1,35 @@
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

@ -0,0 +1,35 @@
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

@ -0,0 +1,94 @@
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 Name: nfs-utils
Version: 2.5.1 Version: 2.5.1
Release: 3 Release: 8
Epoch: 1 Epoch: 1
Summary: The Linux NFS userland utility package Summary: The Linux NFS userland utility package
License: MIT and GPLv2 and GPLv2+ and BSD License: MIT and GPLv2 and GPLv2+ and BSD
@ -14,6 +14,10 @@ Source0: https://www.kernel.org/pub/linux/utils/nfs-utils/%{version}/%{name}-%{v
Patch0: 0000-systemd-idmapd-require-rpc-pipefs.patch Patch0: 0000-systemd-idmapd-require-rpc-pipefs.patch
Patch1: 0001-correct-the-statd-path-in-man.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: libevent-devel,libcap-devel, libtirpc-devel libblkid-devel
BuildRequires: krb5-libs >= 1.4 autoconf >= 2.57 openldap-devel >= 2.2 BuildRequires: krb5-libs >= 1.4 autoconf >= 2.57 openldap-devel >= 2.2
@ -222,6 +226,23 @@ fi
%{_mandir}/*/* %{_mandir}/*/*
%changelog %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 * Wed Nov 11 2020 lixiaokeng <lixiaokeng@huawei.com> - 2.5.1-3
- add epoch to the version of help package required - add epoch to the version of help package required