fuser -m <device> fails to detect open files on a filesystem that has been lazily unmounted.
This is bad since a typical use case for "fuser -m" is to kill remaining users of a filesystem.
Testcase:
dd if=/dev/zero of=fs.img bs=1M count=100
losetup /dev/loop4 fs.img
mkfs.ext2 /dev/loop4
mkdir mnt
mount /dev/loop4 mnt
touch mnt/testfile
less mnt/testfile
<CTRL>-Z
fuser -m mnt
fuser -m /dev/loop4
umount -l mnt
fuser -m /dev/loop4
Patch:
Checked the /proc/PID/fd/# and it reports the correct device for a file on a lazy unmounted fs so fuser does the filtering.
It seems that fuser makes a check that a device is only added to the scanlist if it's found on the mounted filesystems. I can see this optimizing a little on some cases but it breaks functionality for a lazy unmounted fs.
Attached patch removes this check completely and also few routines and datatype definition becoming obsolete.
Anonymous
patch allowing fuser -m <dev> work on lazy umounted fs
hello, I tested the patch on Red Hat Enterprise Linux 5 with positive results
Thankyou for your patch. I have applied it to the code in the CVS and it will appear in the next psmisc release.