From 4a5d49090cd7ca7276d004452e3431e8fe666729 Mon Sep 17 00:00:00 2001 From: Jan Rybar Date: Tue, 19 Feb 2019 16:44:32 +0100 Subject: [PATCH] Added nullptr sanity to scan fns to avoid useless work stalling NFS --- ...sc-23.1-no-nullptr-sanity-stalls-nfs.patch | 45 +++++++++++++++++++ psmisc.spec | 7 ++- 2 files changed, 51 insertions(+), 1 deletion(-) create mode 100644 psmisc-23.1-no-nullptr-sanity-stalls-nfs.patch diff --git a/psmisc-23.1-no-nullptr-sanity-stalls-nfs.patch b/psmisc-23.1-no-nullptr-sanity-stalls-nfs.patch new file mode 100644 index 0000000..b860425 --- /dev/null +++ b/psmisc-23.1-no-nullptr-sanity-stalls-nfs.patch @@ -0,0 +1,45 @@ +diff -up ./src/fuser.c.ori ./src/fuser.c +--- ./src/fuser.c.ori 2017-03-25 00:17:53.169339912 +0100 ++++ ./src/fuser.c 2019-02-19 16:42:04.781433478 +0100 +@@ -187,6 +187,9 @@ scan_procs(struct names *names_head, str + pid_t pid, my_pid; + uid_t uid; + ++ if ( (ino_head == NULL) && (dev_head == NULL) ) ++ return; ++ + if ((topproc_dir = opendir("/proc")) == NULL) { + fprintf(stderr, _("Cannot open /proc directory: %s\n"), + strerror(errno)); +@@ -1860,6 +1863,10 @@ scan_knfsd(struct names *names_head, str + char *find_space; + struct stat st; + ++ if ( (ino_head == NULL) && (dev_head == NULL) ) ++ return; ++ ++ + if ((fp = fopen(KNFSD_EXPORTS, "r")) == NULL) { + #ifdef DEBUG + printf("Cannot open %s\n", KNFSD_EXPORTS); +@@ -1906,6 +1913,10 @@ scan_mounts(struct names *names_head, st + char *find_space; + struct stat st; + ++ if ( (ino_head == NULL) && (dev_head == NULL) ) ++ return; ++ ++ + if ((fp = fopen(PROC_MOUNTS, "r")) == NULL) { + fprintf(stderr, "Cannot open %s\n", PROC_MOUNTS); + return; +@@ -1949,6 +1960,9 @@ scan_swaps(struct names *names_head, str + char *find_space; + struct stat st; + ++ if ( (ino_head == NULL) && (dev_head == NULL) ) ++ return; ++ + if ((fp = fopen(PROC_SWAPS, "r")) == NULL) { + /*fprintf(stderr, "Cannot open %s\n", PROC_SWAPS); */ + return; diff --git a/psmisc.spec b/psmisc.spec index 358c4c5..bf0ba24 100644 --- a/psmisc.spec +++ b/psmisc.spec @@ -2,7 +2,7 @@ Summary: Utilities for managing processes on your system Name: psmisc Version: 23.1 -Release: 5%{?dist} +Release: 6%{?dist} License: GPLv2+ URL: https://gitlab.com/psmisc/psmisc @@ -10,6 +10,7 @@ Source: https://sourceforge.net/projects/%{name}/files/%{name}/%{name}-%{version #The following has been reworked by upstream in a different way ... we'll see #Patch1: psmisc-22.13-fuser-silent.patch +Patch2: psmisc-23.1-no-nullptr-sanity-stalls-nfs.patch BuildRequires: libselinux-devel BuildRequires: gettext @@ -29,6 +30,7 @@ command shows the path of log files owned by a given process. %prep %setup -q +%patch2 -p1 %build %configure --prefix=%{_prefix} --enable-selinux @@ -67,6 +69,9 @@ mv $RPM_BUILD_ROOT%{_bindir}/fuser $RPM_BUILD_ROOT%{_sbindir} %changelog +* Mon Feb 18 2019 Jan Rybar - 23.1-6 +- Added nullptr sanity to scan fns to avoid useless work stalling NFS + * Sat Feb 02 2019 Fedora Release Engineering - 23.1-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild