Accepting request 508459 from Base:System
- Remove patches * psmisc-22.21-lessnfs.patch * psmisc-22.21-mntpt.patch * psmisc-23.0-net.patch - Add patch 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch from https://gitlab.com/bitstreamout/psmisc/tree/mountinfo which is a heavily rework fuser used on NFS * Use mountinfo to be able to use the mount identity which allows to distinguish different mounts with the same device number as it happens with NFS shares. * Smaller cleanup as support of chroot environments and older systems. * Add support for name_to_handle_at() system call to get the real mount ID for each file - Use test suite of psmisc in %check rpm section - Add patch psmisc-23.0-net.patch to reenable network support broken to my own upstream commit OBS-URL: https://build.opensuse.org/request/show/508459 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/psmisc?expand=0&rev=63
This commit is contained in:
commit
73765a4049
1031
0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch
Normal file
1031
0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,81 +0,0 @@
|
||||
Use string comparision only if case of searching for NFS shares
|
||||
|
||||
---
|
||||
src/fuser.c | 29 +++++++++++++++++++++--------
|
||||
src/fuser.h | 2 +-
|
||||
2 files changed, 22 insertions(+), 9 deletions(-)
|
||||
|
||||
--- src/fuser.c
|
||||
+++ src/fuser.c 2017-06-20 14:30:08.176217649 +0000
|
||||
@@ -2007,6 +2007,7 @@ static void clear_mntinfo(void)
|
||||
|
||||
static void init_mntinfo(void)
|
||||
{
|
||||
+ char type[256];
|
||||
char mpoint[PATH_MAX*4 + 1]; // octal escaping takes 4 chars per 1 char
|
||||
int mid, parid, max = 0;
|
||||
uint maj, min;
|
||||
@@ -2018,8 +2019,8 @@ static void init_mntinfo(void)
|
||||
if ((mnt = fopen("/proc/self/mountinfo", "r")) == (FILE *) 0)
|
||||
return;
|
||||
while (fscanf
|
||||
- (mnt, "%i %i %u:%u %*s %s %*[^\n]", &mid, &parid, &maj, &min,
|
||||
- &mpoint[0]) == 5) {
|
||||
+ (mnt, "%i %i %u:%u %*s %s %*s %*s - %s %*[^\n]",
|
||||
+ &mid, &parid, &maj, &min, &mpoint[0], &type[0]) == 6) {
|
||||
const size_t nlen = strlen(mpoint);
|
||||
mntinfo_t *restrict mnt;
|
||||
if (posix_memalign
|
||||
@@ -2038,6 +2039,9 @@ static void init_mntinfo(void)
|
||||
mnt->parid = parid;
|
||||
mnt->dev = makedev(maj, min);
|
||||
mnt->id = mid;
|
||||
+ if (strncmp("nfs", type, 3) == 0)
|
||||
+ mnt->nfs = 1;
|
||||
+ else mnt->nfs = 0;
|
||||
if (mid > max)
|
||||
max = mid;
|
||||
}
|
||||
@@ -2105,16 +2109,25 @@ static int mntstat(const char *path, str
|
||||
if (nlen < mnt->nlen)
|
||||
continue;
|
||||
if (mnt->nlen == 1) { /* root fs is the last entry */
|
||||
- buf->st_dev = mnt->dev;
|
||||
- buf->st_ino = 0;
|
||||
- return 0;
|
||||
+ if (mnt->nfs) {
|
||||
+ fprintf(stderr, "NFS %s\n", use);
|
||||
+ buf->st_dev = mnt->dev;
|
||||
+ buf->st_ino = 0;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ errno = 0;
|
||||
+ return stat(path, buf);
|
||||
}
|
||||
if (use[mnt->nlen] != '\0' && use[mnt->nlen] != '/')
|
||||
continue;
|
||||
if (strncmp(use, mnt->mpoint, mnt->nlen) == 0) {
|
||||
- buf->st_dev = mnt->dev;
|
||||
- buf->st_ino = 0;
|
||||
- return 0;
|
||||
+ if (mnt->nfs) {
|
||||
+ buf->st_dev = mnt->dev;
|
||||
+ buf->st_ino = 0;
|
||||
+ return 0;
|
||||
+ }
|
||||
+ errno = 0;
|
||||
+ return stat(path, buf);
|
||||
}
|
||||
}
|
||||
errno = ENOENT;
|
||||
--- src/fuser.h
|
||||
+++ src/fuser.h 2017-06-20 14:28:48.013689702 +0000
|
||||
@@ -91,7 +91,7 @@ struct mount_list {
|
||||
# include "lists.h"
|
||||
typedef struct mntinfo_s {
|
||||
list_t this;
|
||||
- int id, parid;
|
||||
+ int id, parid, nfs:1;
|
||||
dev_t dev;
|
||||
size_t nlen;
|
||||
char *mpoint;
|
@ -1,23 +0,0 @@
|
||||
For bug boo#908068: fuser -m not handling block devices properly
|
||||
Avoid string comparision for device files
|
||||
|
||||
---
|
||||
src/fuser.c | 7 +++++++
|
||||
1 file changed, 7 insertions(+)
|
||||
|
||||
--- src/fuser.c
|
||||
+++ src/fuser.c 2017-06-20 13:56:29.717283482 +0000
|
||||
@@ -1915,6 +1915,13 @@ static int mntstat(const char *path, str
|
||||
errno = 0;
|
||||
return stat(path, buf);
|
||||
}
|
||||
+ if (strncmp("/dev/", use, 5) == 0) {
|
||||
+ /*
|
||||
+ * Could be a special file (socket, pipe, inotify)
|
||||
+ */
|
||||
+ errno = 0;
|
||||
+ return stat(path, buf);
|
||||
+ }
|
||||
|
||||
nlen = strlen(use);
|
||||
list_for_each(ptr, &mntinfo) {
|
@ -1,21 +1,21 @@
|
||||
---
|
||||
configure.ac | 4 ++--
|
||||
doc/Makefile.am | 2 +-
|
||||
src/fuser.c | 13 ++++++++-----
|
||||
3 files changed, 11 insertions(+), 8 deletions(-)
|
||||
src/fuser.c | 5 ++++-
|
||||
3 files changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
--- configure.ac
|
||||
+++ configure.ac 2017-06-20 14:31:15.914973762 +0000
|
||||
@@ -42,7 +42,7 @@ fi
|
||||
+++ configure.ac 2017-07-05 13:18:18.806270222 +0000
|
||||
@@ -45,7 +45,7 @@ fi
|
||||
if test "$enable_timeout_stat" = "static"; then
|
||||
AC_DEFINE([WITH_TIMEOUT_STAT], [2], [Use timeout on stat calls])
|
||||
fi
|
||||
-AM_CONDITIONAL([WANT_TIMEOUT_STAT], [test "$enable_timeout_stat" = "static"])
|
||||
+AM_CONDITIONAL([WANT_TIMEOUT_STAT], [test "$enable_timeout_stat" != "no"])
|
||||
|
||||
# Use string search for network based file systems but only if the system
|
||||
# has /proc/self/mountinfo
|
||||
@@ -126,7 +126,7 @@ AC_CHECK_MEMBERS([struct user_regs_struc
|
||||
# Use /proc/self/mountinfo if available
|
||||
if test -e /proc/self/mountinfo ; then
|
||||
@@ -142,7 +142,7 @@ AC_CHECK_MEMBERS([struct user_regs_struc
|
||||
struct user_regs_struct.rdi,
|
||||
struct user_regs_struct.rsi,
|
||||
struct user_regs_struct.rdx], [],[],
|
||||
@ -25,7 +25,7 @@
|
||||
AC_CHECK_MEMBERS([struct pt_regs.orig_gpr3,
|
||||
struct pt_regs.gpr], [],[], [#include <linux/ptrace.h>])
|
||||
--- doc/Makefile.am
|
||||
+++ doc/Makefile.am 2017-06-20 15:23:10.973015404 +0000
|
||||
+++ doc/Makefile.am 2017-07-05 13:18:18.806270222 +0000
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
-man_MANS = killall.1 peekfd.1 prtstat.1 pstree.1
|
||||
@ -34,8 +34,8 @@
|
||||
|
||||
if WANT_FUSER
|
||||
--- src/fuser.c
|
||||
+++ src/fuser.c 2017-06-20 14:33:26.908568387 +0000
|
||||
@@ -1041,6 +1041,7 @@ int main(int argc, char *argv[])
|
||||
+++ src/fuser.c 2017-07-05 13:18:18.806270222 +0000
|
||||
@@ -1085,6 +1085,7 @@ int main(int argc, char *argv[])
|
||||
struct option *optr;
|
||||
char *nsptr;
|
||||
int skip_argv;
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
struct option options[] = {
|
||||
{"all", 0, NULL, 'a'},
|
||||
@@ -1084,6 +1085,7 @@ int main(int argc, char *argv[])
|
||||
@@ -1128,6 +1129,7 @@ int main(int argc, char *argv[])
|
||||
#endif
|
||||
atexit(atexit_free_lists);
|
||||
|
||||
@ -51,7 +51,7 @@
|
||||
for (argc_cnt = 1; argc_cnt < argc; argc_cnt++) {
|
||||
current_argv = argv[argc_cnt];
|
||||
if (current_argv[0] == '-') { /* its an option */
|
||||
@@ -1234,6 +1236,7 @@ int main(int argc, char *argv[])
|
||||
@@ -1273,6 +1275,7 @@ int main(int argc, char *argv[])
|
||||
}
|
||||
}
|
||||
this_name->matched_procs = NULL;
|
||||
@ -59,7 +59,7 @@
|
||||
if (opts & (OPT_MOUNTS | OPT_ISMOUNTPOINT)
|
||||
&& this_name->name_space != NAMESPACE_FILE) {
|
||||
free(this_name);
|
||||
@@ -1287,7 +1290,7 @@ int main(int argc, char *argv[])
|
||||
@@ -1326,7 +1329,7 @@ int main(int argc, char *argv[])
|
||||
names_tail->next = this_name;
|
||||
names_tail = this_name;
|
||||
} /* for across the argvs */
|
||||
@ -68,25 +68,3 @@
|
||||
usage(_("No process specification given"));
|
||||
|
||||
/* Check if -M flag was used and if so check mounts */
|
||||
@@ -1551,17 +1554,17 @@ check_dir(const pid_t pid, const char *d
|
||||
struct device_list *dev_tmp;
|
||||
struct unixsocket_list *sock_tmp;
|
||||
struct stat st, lst;
|
||||
- char dirpath[MAX_PATHNAME];
|
||||
- char filepath[MAX_PATHNAME];
|
||||
+ char dirpath[PATH_MAX+1];
|
||||
+ char filepath[PATH_MAX+1];
|
||||
|
||||
- snprintf(dirpath, MAX_PATHNAME, "/proc/%d/%s", pid, dirname);
|
||||
+ snprintf(dirpath, PATH_MAX , "/proc/%d/%s", pid, dirname);
|
||||
if ((dirp = opendir(dirpath)) == NULL)
|
||||
return;
|
||||
while ((direntry = readdir(dirp)) != NULL) {
|
||||
if (direntry->d_name[0] < '0' || direntry->d_name[0] > '9')
|
||||
continue;
|
||||
|
||||
- snprintf(filepath, MAX_PATHNAME, "/proc/%d/%s/%s",
|
||||
+ snprintf(filepath, PATH_MAX, "/proc/%d/%s/%s",
|
||||
pid, dirname, direntry->d_name);
|
||||
|
||||
if (timeout(thestat, filepath, &st, 5) != 0) {
|
||||
|
@ -1,3 +1,29 @@
|
||||
-------------------------------------------------------------------
|
||||
Wed Jul 5 13:24:01 UTC 2017 - werner@suse.de
|
||||
|
||||
- Remove patches
|
||||
* psmisc-22.21-lessnfs.patch
|
||||
* psmisc-22.21-mntpt.patch
|
||||
* psmisc-23.0-net.patch
|
||||
- Add patch
|
||||
0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch
|
||||
from https://gitlab.com/bitstreamout/psmisc/tree/mountinfo
|
||||
which is a heavily rework fuser used on NFS
|
||||
* Use mountinfo to be able to use the mount identity
|
||||
which allows to distinguish different mounts with the
|
||||
same device number as it happens with NFS shares.
|
||||
* Smaller cleanup as support of chroot environments
|
||||
and older systems.
|
||||
* Add support for name_to_handle_at() system call to
|
||||
get the real mount ID for each file
|
||||
- Use test suite of psmisc in %check rpm section
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jun 28 13:11:49 UTC 2017 - werner@suse.de
|
||||
|
||||
- Add patch psmisc-23.0-net.patch to reenable network support
|
||||
broken to my own upstream commit
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Jun 28 10:00:16 UTC 2017 - werner@suse.de
|
||||
|
||||
|
21
psmisc.spec
21
psmisc.spec
@ -17,7 +17,9 @@
|
||||
|
||||
|
||||
Name: psmisc
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: dejagnu
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: gettext-devel
|
||||
BuildRequires: glibc-devel
|
||||
@ -35,12 +37,11 @@ Group: System/Monitoring
|
||||
Source: https://gitlab.com/%{name}/%{name}/repository/archive.tar.bz2?ref=v%{version}#/%{name}-%{version}.tar.bz2
|
||||
Patch0: %{name}-%{version}.dif
|
||||
Patch2: %{name}-22.21-pstree.patch
|
||||
# PATCH-FIX-SUSE boo#908068 -- fuser -m not handling block devices properly
|
||||
Patch4: %{name}-22.21-mntpt.patch
|
||||
# PATCH-ADD-SUSE use string comparision only for nfs shares
|
||||
Patch5: %{name}-22.21-lessnfs.patch
|
||||
# PATCH-ADD-SUSE boo#908068, boo#1046237, boo#1046237
|
||||
# https://gitlab.com/bitstreamout/psmisc/tree/mountinfo
|
||||
Patch3: 0001-Use-mountinfo-to-be-able-to-use-the-mount-identity.patch
|
||||
# PATCH-FIX_UPSTREAM boo#1046237 -- Debug output in killall from psmisc package
|
||||
Patch6: %{name}-%{version}-killall.patch
|
||||
Patch4: %{name}-%{version}-killall.patch
|
||||
|
||||
%define have_peekfd %ix86 x86_64 ppc ppc64 ppc64le %arm mipsel m68k
|
||||
|
||||
@ -58,10 +59,9 @@ processes that are using specified files or filesystems.
|
||||
ln -sf %{name}-v%{version}-%{hash} %{name}-%version
|
||||
%setup -q -D -n %{name}-%version
|
||||
%patch2 -p0 -b .pstree
|
||||
%patch4 -p0 -b .mntpt
|
||||
%patch5 -p0 -b .lessnfs
|
||||
%patch6 -p0 -b .ka
|
||||
%patch0 -p0 -b .0
|
||||
%patch3 -p0 -b .mntinf
|
||||
%patch4 -p0 -b .ka
|
||||
%patch0 -p0 -b .p0
|
||||
|
||||
%build
|
||||
grep -h src/ po/*.po|\
|
||||
@ -80,6 +80,9 @@ export CFLAGS CXXFLAGS
|
||||
--enable-timeout-stat=static
|
||||
make %{?_smp_mflags} CFLAGS="$CFLAGS" "CC=$CC"
|
||||
|
||||
%check
|
||||
make check
|
||||
|
||||
%install
|
||||
make DESTDIR=%{buildroot} install
|
||||
mkdir -p %{buildroot}/bin/
|
||||
|
Loading…
Reference in New Issue
Block a user