Bug 1575850 - umount command with -t option doesn't actually uses -t to match the type in mtab or /proc/mounts
Summary: umount command with -t option doesn't actually uses -t to match the type in m...
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: util-linux-ng
Version: 6.9
Hardware: Unspecified
OS: Linux
unspecified
high
Target Milestone: rc
: ---
Assignee: Karel Zak
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-05-08 05:53 UTC by Archana Pandey
Modified: 2019-02-14 15:00 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-02-14 15:00:06 UTC
Target Upstream Version:


Attachments (Terms of Use)

Description Archana Pandey 2018-05-08 05:53:16 UTC
Description of problem:
In RHEL 6.9 there is no symlink between proc/mounts and mtab, because of which if in any case mtab and /proc/mounts have non matching entries then umount command triggered with -t option doesn't work in expected way.


Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.mount a path on NFS3 and then again mount the safe path on some other file sytem say 'xyz'
2.now remove entry from mtab for xyz manually,by editing mtab
3.Mtab has one entry for mounted path(over NFS) and /proc/mounts has both entries(NFS and xyz)
4. unmount path using -t as 'xyz'

Actual results:
umount unmounts the path from NFS, no entry now found in mtab for mounted path
/proc/mounts still has 'xyz' mount entry, now there is no way you can umount path form 'xyz'

Expected results:
umount should match the mentioned type, if mtab is corruped error should be given instead of wrong umount. 

Additional info:

Comment 2 Ondrej Vasik 2018-05-08 21:33:19 UTC
util-linux-ng package owns mount and umount, so reassigning there. I believe this is expected behaviour, though - as you mentioned, /etc/mtab can differ from actual /proc/mounts ... but Karel can better comment on this.

Comment 3 Karel Zak 2018-09-06 09:42:54 UTC
It would be nice to have examples (copy & past).

Anyway, the umount uses "-t" only when umount all filesystems (--all), otherwise the option is silently ignored. (Well, umount.8 man page should be probably more explicit about -t and -a relation. Now it's in synopsis only.)

Seems like NOTABUG.

Comment 4 Archana Pandey 2018-09-13 11:51:27 UTC
STEP 1- : on running mount command, output is
[root@localhost ~]# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
/dev/sda1 on /boot type ext4 (rw)
10.164.8.32:/opt/PfTest/JenkinsTest-a98f29254a48-nfsv3-1 on /Test/PERF/NFS3/TEST-1536309067_1 type nfs (rw,nfsvers=3,hard,intr,addr=10.164.8.32)
10.164.8.32:/opt/PfTest/JenkinsTest-a98f29254a48-nfsv3-2 on /Test/PERF/NFS3/TEST-1536309067_2 type nfs (rw,nfsvers=3,hard,intr,addr=10.164.8.32)
10.164.8.32:/opt/PfTest/JenkinsTest-a98f29254a48-nfsv3-3 on /Test/PERF/NFS3/TEST-1536309067_3 type nfs (rw,nfsvers=3,hard,intr,addr=10.164.8.32)
10.164.8.32:/opt/PfTest/JenkinsTest-a98f29254a48-nfsv3-4 on /Test/PERF/NFS3/TEST-1536309067_4 type nfs (rw,nfsvers=3,hard,intr,addr=10.164.8.32)
10.164.8.32:/opt/PfTest/JenkinsTest-a98f29254a48-nfsv3-5 on /Test/PERF/NFS3/TEST-1536309067_5 type nfs (rw,nfsvers=3,hard,intr,addr=10.164.8.32)
[root@localhost ~]#

STEP-2 on checking /proc/mounts, output is :

[root@localhost ~]# cat /proc/mounts
rootfs / rootfs rw 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
devtmpfs /dev devtmpfs rw,relatime,size=1948328k,nr_inodes=487082,mode=755 0 0
devpts /dev/pts devpts rw,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /dev/shm tmpfs rw,relatime 0 0
/dev/mapper/VolGroup-lv_root / ext4 rw,relatime,barrier=1,data=ordered 0 0
/proc/bus/usb /proc/bus/usb usbfs rw,relatime 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
/etc/auto.misc /misc autofs rw,relatime,fd=7,pgrp=2172,timeout=300,minproto=5,maxproto=5,indirect 0 0
-hosts /net autofs rw,relatime,fd=13,pgrp=2172,timeout=300,minproto=5,maxproto=5,indirect 0 0
nfsd /proc/fs/nfsd nfsd rw,relatime 0 0
/dev/sda1 /boot ext4 rw,relatime,barrier=1,data=ordered 0 0
10.164.8.32:/opt/PfTest/JenkinsTest-a98f29254a48-nfsv3-1 /Test/PERF/NFS3/TEST-1536309067_1 nfs rw,relatime,vers=3,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.164.8.32,mountvers=3,mountport=38256,mountproto=udp,local_lock=none,addr=10.164.8.32 0 0
10.164.8.32:/opt/PfTest/JenkinsTest-a98f29254a48-nfsv3-2 /Test/PERF/NFS3/TEST-1536309067_2 nfs rw,relatime,vers=3,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.164.8.32,mountvers=3,mountport=38256,mountproto=udp,local_lock=none,addr=10.164.8.32 0 0
10.164.8.32:/opt/PfTest/JenkinsTest-a98f29254a48-nfsv3-3 /Test/PERF/NFS3/TEST-1536309067_3 nfs rw,relatime,vers=3,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.164.8.32,mountvers=3,mountport=38256,mountproto=udp,local_lock=none,addr=10.164.8.32 0 0
10.164.8.32:/opt/PfTest/JenkinsTest-a98f29254a48-nfsv3-4 /Test/PERF/NFS3/TEST-1536309067_4 nfs rw,relatime,vers=3,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.164.8.32,mountvers=3,mountport=38256,mountproto=udp,local_lock=none,addr=10.164.8.32 0 0
10.164.8.32:/opt/PfTest/JenkinsTest-a98f29254a48-nfsv3-5 /Test/PERF/NFS3/TEST-1536309067_5 nfs rw,relatime,vers=3,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.164.8.32,mountvers=3,mountport=38256,mountproto=udp,local_lock=none,addr=10.164.8.32 0 0
/Test/PERF/NFS3/TEST-1536309067_1/ /Test/PERF/NFS3/TEST-1536309067_1 safenetfs rw,relatime 0 0
/Test/PERF/NFS3/TEST-1536309067_5/ /Test/PERF/NFS3/TEST-1536309067_5 safenetfs rw,relatime 0 0
/Test/PERF/NFS3/TEST-1536309067_4/ /Test/PERF/NFS3/TEST-1536309067_4 safenetfs rw,relatime 0 0
/Test/PERF/NFS3/TEST-1536309067_2/ /Test/PERF/NFS3/TEST-1536309067_2 safenetfs rw,relatime 0 0
/Test/PERF/NFS3/TEST-1536309067_3/ /Test/PERF/NFS3/TEST-1536309067_3 safenetfs rw,relatime 0 0

STEP 3 : when umount path with -t option where filesystem type mentioned is nfs, status of /etc/mtab is:

[root@localhost ~]# umount -a -t nfs
[root@localhost ~]# mount
/dev/mapper/VolGroup-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
/dev/sda1 on /boot type ext4 (rw)


STEP 4: status of /proc/mounts is :
[root@localhost ~]# cat /proc/mounts
rootfs / rootfs rw 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
devtmpfs /dev devtmpfs rw,relatime,size=1948328k,nr_inodes=487082,mode=755 0 0
devpts /dev/pts devpts rw,relatime,gid=5,mode=620,ptmxmode=000 0 0
tmpfs /dev/shm tmpfs rw,relatime 0 0
/dev/mapper/VolGroup-lv_root / ext4 rw,relatime,barrier=1,data=ordered 0 0
/proc/bus/usb /proc/bus/usb usbfs rw,relatime 0 0
sunrpc /var/lib/nfs/rpc_pipefs rpc_pipefs rw,relatime 0 0
/etc/auto.misc /misc autofs rw,relatime,fd=7,pgrp=2172,timeout=300,minproto=5,maxproto=5,indirect 0 0
-hosts /net autofs rw,relatime,fd=13,pgrp=2172,timeout=300,minproto=5,maxproto=5,indirect 0 0
nfsd /proc/fs/nfsd nfsd rw,relatime 0 0
/dev/sda1 /boot ext4 rw,relatime,barrier=1,data=ordered 0 0
10.164.8.32:/opt/PfTest/JenkinsTest-a98f29254a48-nfsv3-1 /Test/PERF/NFS3/TEST-1536309067_1 nfs rw,relatime,vers=3,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.164.8.32,mountvers=3,mountport=38256,mountproto=udp,local_lock=none,addr=10.164.8.32 0 0
10.164.8.32:/opt/PfTest/JenkinsTest-a98f29254a48-nfsv3-2 /Test/PERF/NFS3/TEST-1536309067_2 nfs rw,relatime,vers=3,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.164.8.32,mountvers=3,mountport=38256,mountproto=udp,local_lock=none,addr=10.164.8.32 0 0
10.164.8.32:/opt/PfTest/JenkinsTest-a98f29254a48-nfsv3-3 /Test/PERF/NFS3/TEST-1536309067_3 nfs rw,relatime,vers=3,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.164.8.32,mountvers=3,mountport=38256,mountproto=udp,local_lock=none,addr=10.164.8.32 0 0
10.164.8.32:/opt/PfTest/JenkinsTest-a98f29254a48-nfsv3-4 /Test/PERF/NFS3/TEST-1536309067_4 nfs rw,relatime,vers=3,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.164.8.32,mountvers=3,mountport=38256,mountproto=udp,local_lock=none,addr=10.164.8.32 0 0
10.164.8.32:/opt/PfTest/JenkinsTest-a98f29254a48-nfsv3-5 /Test/PERF/NFS3/TEST-1536309067_5 nfs rw,relatime,vers=3,rsize=262144,wsize=262144,namlen=255,hard,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.164.8.32,mountvers=3,mountport=38256,mountproto=udp,local_lock=none,addr=10.164.8.32 0 0

Issue: we cannot see any entry in mtab for base nfs mount, but /proc/mounts still hold the entries for nfs. now if we check /etc/mtab only then we should be able to again mount these paths on nfs,but because entries are present in /proc/mounts error is given:
[root@localhost ~]# mount -a
mount.nfs: /Test/PERF/NFS3/TEST-1536309067_1 is busy or already mounted
mount.nfs: /Test/PERF/NFS3/TEST-1536309067_2 is busy or already mounted
mount.nfs: /Test/PERF/NFS3/TEST-1536309067_3 is busy or already mounted
mount.nfs: /Test/PERF/NFS3/TEST-1536309067_4 is busy or already mounted
mount.nfs: /Test/PERF/NFS3/TEST-1536309067_5 is busy or already mounted

which creates problem,
P.S. : we are unable to make entry for later filesystem mounts (safenetfs) in mtab,as mtab gets corrupted when number of paths is high.

Comment 5 Archana Pandey 2018-09-13 14:25:40 UTC
yes, as per synopsis umount checks entries in /etc/mtab only so it is successfully removing the entries from mtab,

but in reality path is still mounted as shown in /proc/mounts.

Comment 6 Karel Zak 2018-09-14 10:47:10 UTC
For umount (in RHEL-6 where is no the symlink) is reality mtab and nothing else, and I do not see another way.

You need to keep your mtab to match reality... 

Note that implement umount for your use-case means that it will be necessary to parse /etc/mtab, and then /proc/mount to verify mtab validity and to join records from mtab with kernel. Seems like pretty complicated for so unusual use-case.

Why you do not have "safenetfs" in your mtab?

Comment 7 Archana Pandey 2018-09-14 11:48:08 UTC
(In reply to Karel Zak from comment #6)
> For umount (in RHEL-6 where is no the symlink) is reality mtab and nothing
> else, and I do not see another way.
> 
> You need to keep your mtab to match reality... 
> 
> Note that implement umount for your use-case means that it will be necessary
> to parse /etc/mtab, and then /proc/mount to verify mtab validity and to join
> records from mtab with kernel. Seems like pretty complicated for so unusual
> use-case.
> 
> Why you do not have "safenetfs" in your mtab?

 we are unable to make entry for later filesystem mounts (safenetfs) in /etc/mtab,as /etc/mtab gets corrupted when number of mounts is high and multiple IO operation are done on these mounted paths.

Also yes, symlink is present in  RHEL 7 for mtab and proc mounts(this must be a fix to some issue or a feature added) and not in rhel 6.

/etc/mtab is editable and can be corrupted by some applications.

If not a symlink in rhel 6, can't we have a graceful implementation to honour -t option and return error/warning/message to show discrepancies between /etc/mtab and /proc/mounts ?

Comment 8 Karel Zak 2018-09-17 09:14:27 UTC
All utils which modify /etc/mtab need to use proper locking, it sound like mistake that the file is corrupted...

I'm really not sure if we really want to implement a new feature (workaround?) to RHEL6.10 update. 

I guess the problem is system shutdown (as "umount -t -a" does not make sense for any other use-case), maybe it would be better to use any script to check the system mount table and mtab before the shutdown or copy /proc/mounts to /etc/mtab.

Comment 9 Karel Zak 2019-02-14 15:00:06 UTC
Closing as WONTFIX.

The problem does not exist on RHEL >= 7 and all the issue is mostly about wrong mtab maintenance by 3rd-party utils rather than a real umount issue.


Note You need to log in before you can comment on or make changes to this bug.