Hello guys.
Our users experience a problem with the fuser tool
output caused by changes in the NFS design introduced
with the following kernel patch:
http://linux-nfs.org/files/Linux-2.6.x/2.6.18-rc4/linux-2.6.18-032-nfs-unify-sb.dif
With this change the fuser tool shows the same PIDs
mixed together for two or more different NFS mountpoints
just because the data are hosted on the same server
and the same filesystem.
Reproduction scenario:
1.) Create the following directories on the server side
(the directory names can differ, but both needs to be
created on the same filesystem)
mkdir -p /data/a
mkdir -p /data/b
2.) Define the following two NFS exports in /etc/exports
on the server side and (re)start the NFS server service
/data/a (rw)
/data/b (rw)
3.) define the following mountpoints in /etc/fstab
on the client side (and modify the server name
to match your server name or IP)
mynfsserver:/data/a /mnt/a nfs rw,noauto 0 0
mynfsserver:/data/b /mnt/b nfs rw,noauto 0 0
4.) create the mountpoints on the client side
and mount the target:
mkdir /mnt/a
mkdir /mnt/b
mount /mnt/a
mount /mnt/b
5.) open two xterms & vi editors in the background
xterm -e "vi /mnt/a/test.txt" &
xterm -e "vi /mnt/b/test.txt" &
6.) check the fuser output for both mountpoints
from the parent terminal
fuser -m /mnt/a
fuser -m /mnt/b
Actual result:
$ fuser -m /mnt/a
/mnt/a: 2056 2059
$ fuser -m /mnt/b
/mnt/b: 2056 2059
As you see. Both mountpoints differ, but they
show the same PIDs.
Expected result:
$ fuser -m /mnt/a
/mnt/a: 2056
$ fuser -m /mnt/b
/mnt/b: 2059
This issue has already been fixed in the 'lsof' tool.
Regards,
Jaromir.
Anonymous
I see the problem now.
The mounts have the same device ID. The files have the same device ID too.
lsof has this problem fixed, I'm not sure how unless its scanning the mount
points.
Indeed ...
YYYY:~ # df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda8 98951772 17168852 80759916 18% /
devtmpfs 955432 0 955432 0% /dev
tmpfs 961240 0 961240 0% /dev/shm
tmpfs 961240 1636 959604 1% /run
tmpfs 961240 0 961240 0% /sys/fs/cgroup
XXXXX:/usr/src/werner 52410496 19221600 33188896 37% /usr/src/werner
XXXXX:/usr/src/werner 52410880 19221504 33189376 37% /mnt
YYYY:~ # stat /usr/src/werner/psmisc/psmisc-22.21.tar.gz
File: '/usr/src/werner/psmisc/psmisc-22.21.tar.gz'
Size: 457702 Blocks: 896 IO Block: 32768 regular file
Device: 1fh/31d Inode: 4200658 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 223/ werner) Gid: ( 50/ suse)
Access: 2014-03-24 14:55:25.709234000 +0100
Modify: 2014-03-24 14:55:25.760241000 +0100
Change: 2014-03-24 14:55:34.118236519 +0100
Birth: -
YYYY:~ # stat /mnt/psmisc/psmisc-22.21.tar.gz
File: '/mnt/psmisc/psmisc-22.21.tar.gz'
Size: 457702 Blocks: 896 IO Block: 524288 regular file
Device: 23h/35d Inode: 4200658 Links: 1
Access: (0644/-rw-r--r--) Uid: ( 223/ werner) Gid: ( 50/ suse)
Access: 2014-03-24 14:55:25.709234000 +0100
Modify: 2014-03-24 14:55:25.760241000 +0100
Change: 2014-03-24 14:55:34.118236519 +0100
Birth: -
the only difference is the IO Block here (guess due different mount options).
Hmm ... no the devices show different 23h versus 1fh on this 3.12.18
Ah ... with the same mount options I see identical data! One thing which may help here is to add string comparision on top of Device/Inode numbers.
Damn, I was hoping you'd have a simpler way.
--
Craig Small (@smallsees) http://enc.com.au/ csmall at : enc.com.au
Debian GNU/Linux http://www.debian.org/ csmall at : debian.org
GPG fingerprint: 5D2F B320 B825 D939 04D2 0519 3938 F96B DF50 FEA5