From afd7e1de87ecf04bd1077898286b147d2d67dd1b Mon Sep 17 00:00:00 2001 From: Daniel Novotny Date: Thu, 23 Apr 2009 10:46:06 +0000 Subject: [PATCH] fix #497303 --- psmisc-22.6-fuser-remove-mountlist.patch | 131 +++++++++++++++++++++++ psmisc.spec | 7 +- 2 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 psmisc-22.6-fuser-remove-mountlist.patch diff --git a/psmisc-22.6-fuser-remove-mountlist.patch b/psmisc-22.6-fuser-remove-mountlist.patch new file mode 100644 index 0000000..0a31cac --- /dev/null +++ b/psmisc-22.6-fuser-remove-mountlist.patch @@ -0,0 +1,131 @@ +diff -ru psmisc-22.6.org/src/fuser.c psmisc-22.6/src/fuser.c +--- psmisc-22.6.org/src/fuser.c 2009-01-23 19:24:11.000000000 +0200 ++++ psmisc-22.6/src/fuser.c 2009-01-23 19:28:43.000000000 +0200 +@@ -69,7 +69,6 @@ + + int parse_mount(struct names *this_name, struct device_list **dev_list); + static void add_device(struct device_list **dev_list, struct names *this_name, dev_t device); +-void scan_mount_devices(const opt_type opts, struct mountdev_list **mount_devices); + void fill_unix_cache(struct unixsocket_list **unixsocket_head); + static dev_t find_net_dev(void); + static void scan_procs(struct names *names_head, struct inode_list *ino_head, struct device_list *dev_head); +@@ -365,10 +364,9 @@ + return 0; + } + +-int parse_mounts(struct names *this_name, struct mountdev_list *mounts, struct device_list **dev_list, const char opts) ++int parse_mounts(struct names *this_name, struct device_list **dev_list, const char opts) + { + struct stat st; +- struct mountdev_list *mountptr; + dev_t match_device; + + if (stat(this_name->filename, &st) != 0) { +@@ -380,13 +378,7 @@ + match_device = st.st_rdev; + else + match_device = st.st_dev; +- for (mountptr = mounts ; mountptr != NULL ; mountptr = mountptr->next) { +- if (mountptr->device == match_device) { +- /*printf("Debug: adding parse_mounts() adding %s\n", +- this_name->filename);*/ +- add_device(dev_list, this_name, match_device); +- } +- } ++ add_device(dev_list, this_name, match_device); + return 0; + } + +@@ -660,7 +652,6 @@ + int ipv4_only, ipv6_only; + #endif + unsigned char default_namespace = NAMESPACE_FILE; +- struct mountdev_list *mount_devices = NULL; + struct device_list *match_devices = NULL; + struct unixsocket_list *unixsockets = NULL; + +@@ -692,7 +683,6 @@ + #endif + + netdev = find_net_dev(); +- scan_mount_devices(opts, &mount_devices); + fill_unix_cache(&unixsockets); + + /* getopt doesnt like things like -SIGBLAH */ +@@ -831,7 +821,7 @@ + parse_file(this_name, &match_inodes); + parse_unixsockets(this_name, &match_inodes, unixsockets); + if (opts & OPT_MOUNTPOINT || opts & OPT_MOUNTS) +- parse_mounts(this_name, mount_devices, &match_devices, opts); ++ parse_mounts(this_name, &match_devices, opts); + break; + } + +@@ -1082,20 +1072,6 @@ + return st.st_uid; + } + +-void add_mount_device(struct mountdev_list **mount_head,const char *fsname, const char *dir, dev_t device) +-{ +- struct mountdev_list *newmount; +- /*printf("Adding mount Path: %s Dir:%s dev:%0x\n",dir, fsname, device);*/ +- +- if ( (newmount = malloc(sizeof(struct mountdev_list))) == NULL) +- return; +- newmount->fsname = strdup(fsname); +- newmount->dir = strdup(dir); +- newmount->device = device; +- newmount->next = *mount_head; +- *mount_head = newmount; +-} +- + /* + * fill_unix_cache : Create a list of Unix sockets + * This list is used later for matching purposes +@@ -1135,28 +1111,6 @@ + + } + +-/* +- * scan_mount_devices : Create a list of mount points and devices +- * This list is used later for matching purposes +- */ +-void scan_mount_devices(const opt_type opts, struct mountdev_list **mount_devices) +-{ +- FILE *mntfp; +- struct mntent *mnt_ptr; +- struct stat st; +- +- if ( (mntfp = setmntent("/etc/mtab","r")) == NULL) { +- fprintf(stderr, _("Cannot open /etc/mtab: %s\n"), +- strerror(errno)); +- return; +- } +- while ( (mnt_ptr = getmntent(mntfp)) != NULL) { +- if (stat(mnt_ptr->mnt_dir, &st) == 0) { +- add_mount_device(mount_devices, mnt_ptr->mnt_fsname, mnt_ptr->mnt_dir, st.st_dev); +- } +- } +-} +- + #ifdef DEBUG + /* often not used, doesnt need translation */ + static void debug_match_lists(struct names *names_head, struct inode_list *ino_head, struct device_list *dev_head) +diff -ru psmisc-22.6.org/src/fuser.h psmisc-22.6/src/fuser.h +--- psmisc-22.6.org/src/fuser.h 2009-01-23 19:24:11.000000000 +0200 ++++ psmisc-22.6/src/fuser.h 2009-01-23 19:29:48.000000000 +0200 +@@ -58,14 +58,6 @@ + struct inode_list *next; + }; + +-struct mountdev_list { +- char *fsname; +- char *dir; +- dev_t device; +- struct mountdev_list *next; +-}; +- +- + struct device_list { + struct names *name; + dev_t device; diff --git a/psmisc.spec b/psmisc.spec index 9a93bea..f136a9a 100644 --- a/psmisc.spec +++ b/psmisc.spec @@ -1,7 +1,7 @@ Summary: Utilities for managing processes on your system Name: psmisc Version: 22.6 -Release: 9%{?dist} +Release: 10%{?dist} License: GPLv2+ Group: Applications/System Source: http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz @@ -10,6 +10,7 @@ Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) Patch0: psmisc-22.6-types.patch Patch1: psmisc-22.6-pstree-overflow.patch +Patch2: psmisc-22.6-fuser-remove-mountlist.patch BuildRequires: libselinux-devel BuildRequires: gettext @@ -28,6 +29,7 @@ of processes that are using specified files or filesystems. %setup -q %patch0 -p1 -b .types %patch1 -p1 -b .overflow +%patch2 -p1 -b .mount %build export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE" @@ -68,6 +70,9 @@ rm -rf $RPM_BUILD_ROOT %endif %changelog +* Thu Apr 23 2009 Daniel Novotny - 22.6-10 +- fix #497303 - fuser -m doesn't work after lazy unmount + * Thu Feb 26 2009 Fedora Release Engineering - 22.6-9 - Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild