Compare commits
10 Commits
5025ac2be2
...
06d459263d
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
06d459263d | ||
|
|
036cb6ce5e | ||
|
|
8d9e11ff52 | ||
|
|
f09b8d3834 | ||
|
|
76e92f2035 | ||
|
|
3df36d847e | ||
|
|
6f8e04a642 | ||
|
|
41e743faa4 | ||
|
|
912db01178 | ||
|
|
6e09ad906b |
28
0003-quota-Add-sw64-architecture.patch
Normal file
28
0003-quota-Add-sw64-architecture.patch
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
From 3801089800f4530408b4d99a3d0bcf0a154bac1f Mon Sep 17 00:00:00 2001
|
||||||
|
From: wzx <wuzx1226@qq.com>
|
||||||
|
Date: Wed, 26 Oct 2022 16:00:36 +0800
|
||||||
|
Subject: [PATCH] Add sw64 architecture
|
||||||
|
|
||||||
|
Add sw64 architecture in file quota.h to suport sw64 architecture.
|
||||||
|
|
||||||
|
Signed-off-by: wzx <wuzx1226@qq.com>
|
||||||
|
---
|
||||||
|
quota.h | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/quota.h b/quota.h
|
||||||
|
index 4c21411..a9c9ecd 100644
|
||||||
|
--- a/quota.h
|
||||||
|
+++ b/quota.h
|
||||||
|
@@ -171,7 +171,7 @@ enum {
|
||||||
|
/* Ioctl for getting quota size */
|
||||||
|
#include <sys/ioctl.h>
|
||||||
|
#ifndef FIOQSIZE
|
||||||
|
- #if defined(__alpha__) || defined(__powerpc__) || defined(__sh__) || defined(__sparc__) || defined(__sparc64__)
|
||||||
|
+ #if defined(__alpha__) || defined(__sw_64__) || defined(__powerpc__) || defined(__sh__) || defined(__sparc__) || defined(__sparc64__)
|
||||||
|
#define FIOQSIZE _IOR('f', 128, loff_t)
|
||||||
|
#elif defined(__arm__) || defined(__mc68000__) || defined(__s390__)
|
||||||
|
#define FIOQSIZE 0x545E
|
||||||
|
--
|
||||||
|
2.33.0
|
||||||
|
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
From 25f16b1de313ce0d411f754572f94f051bfbe3c8 Mon Sep 17 00:00:00 2001
|
||||||
|
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
||||||
|
Date: Tue, 16 Mar 2021 17:28:15 +0100
|
||||||
|
Subject: [PATCH] quota_nld: Initialize sa_mask when registering PID file
|
||||||
|
removal
|
||||||
|
MIME-Version: 1.0
|
||||||
|
Content-Type: text/plain; charset=UTF-8
|
||||||
|
Content-Transfer-Encoding: 8bit
|
||||||
|
|
||||||
|
term_action.sa_mask is an automatic variable and and thus unitialized.
|
||||||
|
This patch empties the signal mask.
|
||||||
|
|
||||||
|
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||||
|
Signed-off-by: Jan Kara <jack@suse.cz>
|
||||||
|
---
|
||||||
|
quota_nld.c | 2 +-
|
||||||
|
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||||
|
|
||||||
|
diff --git a/quota_nld.c b/quota_nld.c
|
||||||
|
index 72d99a9..09c4775 100644
|
||||||
|
--- a/quota_nld.c
|
||||||
|
+++ b/quota_nld.c
|
||||||
|
@@ -466,7 +466,7 @@ static void use_pid_file(void)
|
||||||
|
|
||||||
|
term_action.sa_handler = remove_pid;
|
||||||
|
term_action.sa_flags = 0;
|
||||||
|
- if (sigaction(SIGTERM, &term_action, NULL))
|
||||||
|
+ if (sigemptyset(&term_action.sa_mask) || sigaction(SIGTERM, &term_action, NULL))
|
||||||
|
errstr(_("Could not register PID file removal on SIGTERM.\n"));
|
||||||
|
if (store_pid())
|
||||||
|
errstr(_("Could not store my PID %jd.\n"), (intmax_t )getpid());
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
110
0005-quota-nld-fix-open-PID-file-failed-when-systemd-read.patch
Normal file
110
0005-quota-nld-fix-open-PID-file-failed-when-systemd-read.patch
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
From 06b93e5c1caf5d36d51132cb85c11a96cbdae023 Mon Sep 17 00:00:00 2001
|
||||||
|
From: "lihaoxiang (F)" <lihaoxiang9@huawei.com>
|
||||||
|
Date: Thu, 1 Dec 2022 12:10:49 +0800
|
||||||
|
Subject: [PATCH] quota-nld: fix open PID file failed when systemd read it
|
||||||
|
|
||||||
|
Running quota_nld by systemd might cause the problem that systemd
|
||||||
|
couldn't open the PID file generated by quota_nld. In fact, the PID
|
||||||
|
file hasn't existed yet because it originates from the child process
|
||||||
|
of quota_nld which is a daemon process. As the main process exit,
|
||||||
|
systemd try to access the PID file but the daemon hadn't create it
|
||||||
|
that time.
|
||||||
|
|
||||||
|
In this situation, we move the procedure of creating PID file into the
|
||||||
|
parent process to ensure the PID file must existed when quota_nld exit.
|
||||||
|
After that, the above problem would never occur again.
|
||||||
|
|
||||||
|
[JK: Fixed up SIGTERM handling and format strings]
|
||||||
|
|
||||||
|
Signed-off-by: lihaoxiang <lihaoxiang9@huawei.com>
|
||||||
|
Signed-off-by: Jan Kara <jack@suse.cz>
|
||||||
|
---
|
||||||
|
quota_nld.c | 44 ++++++++++++++++++++++++++++++++++----------
|
||||||
|
1 file changed, 34 insertions(+), 10 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/quota_nld.c b/quota_nld.c
|
||||||
|
index 09c4775..82e60c2 100644
|
||||||
|
--- a/quota_nld.c
|
||||||
|
+++ b/quota_nld.c
|
||||||
|
@@ -413,7 +413,7 @@ static char *build_pid_file_name(void)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Store daemon's PID to file */
|
||||||
|
-static int store_pid(void)
|
||||||
|
+static int store_pid(pid_t pid)
|
||||||
|
{
|
||||||
|
FILE *pid_file;
|
||||||
|
char *pid_name;
|
||||||
|
@@ -429,7 +429,7 @@ static int store_pid(void)
|
||||||
|
free(pid_name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
- if (fprintf(pid_file, "%jd\n", (intmax_t)getpid()) < 0) {
|
||||||
|
+ if (fprintf(pid_file, "%d\n", (int)pid) < 0) {
|
||||||
|
errstr(_("Could not write daemon's PID into '%s'.\n"),
|
||||||
|
pid_name);
|
||||||
|
fclose(pid_file);
|
||||||
|
@@ -460,7 +460,7 @@ static void remove_pid(int signal)
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Store daemon's PID into file and register its removal on SIGTERM */
|
||||||
|
-static void use_pid_file(void)
|
||||||
|
+static void setup_sigterm_handler(void)
|
||||||
|
{
|
||||||
|
struct sigaction term_action;
|
||||||
|
|
||||||
|
@@ -468,8 +468,36 @@ static void use_pid_file(void)
|
||||||
|
term_action.sa_flags = 0;
|
||||||
|
if (sigemptyset(&term_action.sa_mask) || sigaction(SIGTERM, &term_action, NULL))
|
||||||
|
errstr(_("Could not register PID file removal on SIGTERM.\n"));
|
||||||
|
- if (store_pid())
|
||||||
|
- errstr(_("Could not store my PID %jd.\n"), (intmax_t )getpid());
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void fork_daemon(void)
|
||||||
|
+{
|
||||||
|
+ pid_t pid = fork();
|
||||||
|
+ if (pid < 0) {
|
||||||
|
+ errstr(_("Failed to daemonize: fork: %s\n"), strerror(errno));
|
||||||
|
+ exit(1);
|
||||||
|
+ } else if (pid != 0) {
|
||||||
|
+ if (store_pid(pid)) {
|
||||||
|
+ errstr(_("Could not store my PID %d.\n"), (int)pid);
|
||||||
|
+ kill(pid, SIGKILL);
|
||||||
|
+ }
|
||||||
|
+ exit(0);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ setup_sigterm_handler();
|
||||||
|
+ if (setsid() < 0) {
|
||||||
|
+ errstr(_("Failed to daemonize: setsid: %s\n"), strerror(errno));
|
||||||
|
+ exit(1);
|
||||||
|
+ }
|
||||||
|
+ if (chdir("/") < 0)
|
||||||
|
+ errstr(_("Failed to chdir in daemonize\n"));
|
||||||
|
+ int fd = open("/dev/null", O_RDWR, 0);
|
||||||
|
+ if (fd >= 0) {
|
||||||
|
+ dup2(fd, STDIN_FILENO);
|
||||||
|
+ dup2(fd, STDOUT_FILENO);
|
||||||
|
+ dup2(fd, STDERR_FILENO);
|
||||||
|
+ close(fd);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char **argv)
|
||||||
|
@@ -485,11 +513,7 @@ int main(int argc, char **argv)
|
||||||
|
dhandle = init_dbus();
|
||||||
|
if (!(flags & FL_NODAEMON)) {
|
||||||
|
use_syslog();
|
||||||
|
- if (daemon(0, 0)) {
|
||||||
|
- errstr(_("Failed to daemonize: %s\n"), strerror(errno));
|
||||||
|
- exit(1);
|
||||||
|
- };
|
||||||
|
- use_pid_file();
|
||||||
|
+ fork_daemon();
|
||||||
|
}
|
||||||
|
run(nsock);
|
||||||
|
return 0;
|
||||||
|
--
|
||||||
|
1.8.3.1
|
||||||
|
|
||||||
36
quota.spec
36
quota.spec
@ -1,7 +1,7 @@
|
|||||||
Name: quota
|
Name: quota
|
||||||
Version: 4.06
|
Version: 4.06
|
||||||
Epoch: 1
|
Epoch: 1
|
||||||
Release: 2
|
Release: 7
|
||||||
Summary: Linux Diskquota system as part of the Linux kernel
|
Summary: Linux Diskquota system as part of the Linux kernel
|
||||||
License: BSD and GPLv2 and GPLv2+ and LGPLv2+
|
License: BSD and GPLv2 and GPLv2+ and LGPLv2+
|
||||||
URL: http://sourceforge.net/projects/linuxquota/
|
URL: http://sourceforge.net/projects/linuxquota/
|
||||||
@ -15,8 +15,11 @@ Source4: rpc-rquotad.sysconfig
|
|||||||
Patch0: 0000-Limit-number-of-comparison-characters-to-4.patch
|
Patch0: 0000-Limit-number-of-comparison-characters-to-4.patch
|
||||||
Patch1: 0001-Limit-maximum-of-RPC-port.patch
|
Patch1: 0001-Limit-maximum-of-RPC-port.patch
|
||||||
Patch2: 0002-quotaio_xfs-Warn-when-large-kernel-timestamps-cannot.patch
|
Patch2: 0002-quotaio_xfs-Warn-when-large-kernel-timestamps-cannot.patch
|
||||||
|
Patch3: 0003-quota-Add-sw64-architecture.patch
|
||||||
|
Patch4: 0004-quota_nld-Initialize-sa_mask-when-registering-PID-fi.patch
|
||||||
|
Patch5: 0005-quota-nld-fix-open-PID-file-failed-when-systemd-read.patch
|
||||||
|
|
||||||
BuildRequires: autoconf, automake, coreutils, rpcgen, systemd
|
BuildRequires: autoconf, automake, coreutils, rpcgen, systemd, gcc
|
||||||
BuildRequires: e2fsprogs-devel, gettext-devel, openldap-devel
|
BuildRequires: e2fsprogs-devel, gettext-devel, openldap-devel
|
||||||
BuildRequires: pkgconfig(dbus-1), pkgconfig(libnl-3.0) >= 3.1, pkgconfig(libnl-genl-3.0), pkgconfig(libtirpc)
|
BuildRequires: pkgconfig(dbus-1), pkgconfig(libnl-3.0) >= 3.1, pkgconfig(libnl-genl-3.0), pkgconfig(libtirpc)
|
||||||
Requires(post): systemd
|
Requires(post): systemd
|
||||||
@ -61,9 +64,9 @@ This contains man files for the using of quota.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%autosetup -n %{name}-%{version} -p1
|
%autosetup -n %{name}-%{version} -p1
|
||||||
autoreconf -fi
|
|
||||||
|
|
||||||
%build
|
%build
|
||||||
|
autoreconf -fi
|
||||||
%configure \
|
%configure \
|
||||||
--enable-bsd-behaviour \
|
--enable-bsd-behaviour \
|
||||||
--enable-ext2direct=yes \
|
--enable-ext2direct=yes \
|
||||||
@ -123,6 +126,33 @@ make check
|
|||||||
%{_mandir}/man*/*
|
%{_mandir}/man*/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Dec 6 2022 lihaoxiang <lihaoxiang9@huawei.com> - 1:4.06-7
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:rebase upstream patch about fix systemd read PID file failed
|
||||||
|
|
||||||
|
* Thu Dec 1 2022 lihaoxiang <lihaoxiang9@huawei.com> - 1:4.06-6
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:fix systemd read PID file failed
|
||||||
|
|
||||||
|
* Wed Oct 26 2022 wuzx<wuzx1226@qq.com> - 1:4.06-5
|
||||||
|
- Type:feature
|
||||||
|
- CVE:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:Add sw64 architecture
|
||||||
|
|
||||||
|
* Tue Oct 11 2022 huangduirong <huangduirong@huawei.com> - 1:4.06-4
|
||||||
|
- Type:bugfix
|
||||||
|
- ID:NA
|
||||||
|
- SUG:NA
|
||||||
|
- DESC:Move autoreconf to build
|
||||||
|
|
||||||
|
* Tue Jun 29 2021 zhouwenpei <zhouwenpei1@huawei.com> - 1:4.06-3
|
||||||
|
- add buildrequire gcc.
|
||||||
|
|
||||||
* Wed Mar 31 2021 xieliuhua <xieliuhua@huawei.com> - 1:4.06-2
|
* Wed Mar 31 2021 xieliuhua <xieliuhua@huawei.com> - 1:4.06-2
|
||||||
- fix Warn when large kernel timestamps cannot be handled
|
- fix Warn when large kernel timestamps cannot be handled
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user