The Samba-Bugzilla – Bug 4370
umount.cfis does not remove mtab entry for relative links
Last modified: 2009-05-04 06:23:20 UTC
Calling suid umount.cfis as a regular user using a relative path as the mount point successfully umounts but does not remove the entry from /etc/mtab
For instance after
# mount.cifs //winmachine/shared /mnt/test
# cd /mnt
# umount.cifs test
does not remove the entry from /etc/mtab. However
# umount.cifs /mnt/test
I am not sure this should be a bug.
Imagine you had two shares mounted on
Now if you were to cd to /mnt and issue command umount.cifs test,
which directory should be unmounted and its entry in /etc/mtab removed?
I think for umount.cifs, you should supply what was mounted on!
I think there is a misunderstanding here. The case you suggest is a little different in that the mount points are
And cd'ing to /mnt and issuing the command
should actually not umount anything (and actually it does not as far as I have tested).
What I consider a bug is to actually succeed the umount but leave the entry in /etc/mtab. If the umount succeeds then umount.cifs should have figured out the absolute path anyway (ar am I mistaken on this?) and should then remove the /etc/mtab entry.
Yes, agree. Sent the working code fix to umount.cifs.c to Steve.
Will wait for what he has to say.
Still valid a year later on Mandriva cooker with mount-cifs-3.0.28-4mdv2008.1
Created attachment 3143 [details]
patch to unmount a filesyetem specified by not absolute path
Here is one attempt to fix the problem. Will post it to the mailing list.
One concern I have is, do we have to consider that path specified to umount command can be relative i.e. ../dir or somethigng like that which will have characters like /, ., and ..
umount.c calls canonicalize to canonize the directory supplied on the
Created attachment 3148 [details]
patch to unmount cifs filesytem with entry in /etc/mtab removed
This is second attempt at the patch, this one handles characters like ., ..,
and / in the path specified to umount.cifs.
Uses standard function canonicalize (which in turn calls function realpath).
I follow this bug from:
I have something else to report. Over at http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=461048 there is better description of the bug. On my system it might not have anything to do with relative paths or trailing slashes. Rather scripts. When umount.cifs is used in a script, the /etc/mtab entry is not removed.
# umount.cifs -V
umount.cifs version: 0.5-3.0.28a
# uname -a
Linux htms04 2.6.24-19-server #1 SMP Wed Jun 18 15:18:00 UTC 2008 i686 GNU/Linux
It's a really lame bug because my /etc/mtab just grows and grows because of mounting and unmounting from the backup scripts run everyday from cron. BTW, they run as root. Yes, I ran the script as root as well. When from bash or dash, it works. When run from in a script, it does not remove the /etc/mtab entry.
Commenting on my comment. I was using double slashes in my script. So this bug also kicks into action with double slashes ( path delimters // \\ )
Sorry for the confusion
This bug is no longer in 3.2.5 nor in 3.3.0-rc2
It doesn't look like Shirish's patches have been committed. Is this really fixed? If so, how was it done?
Running debian and this bug seems to still exist in 3.2.5 for me.
I can't recreate this problem
cifstest6:/mnt # smbd -V
cifstest6:~ # type umount.cifs
umount.cifs is hashed (/sbin/umount.cifs)
cifstest6:~ # /sbin/umount.cifs -V
umount.cifs version: 0.5-3.2.5-1.3-2022
cifstest6:~ # mount
//cifstest1/public on /mnt/smb_a type cifs (rw,mand)
cifstest6:~ # cd /mnt
cifstest6:/ # umount.cifs /mnt/smb_a
cifstest6:/mnt # cat /etc/mtab
- mount entry does not exist in file /etc/mtab anymore.
(In reply to comment #1)
I tried above as a non-root user (using sudo command) and could not
recreate the problem, /etc/mtab is sans the entry after umount.cifs.
I am sorry, please disregard comments #13 and #14, I was not recreating
the problem correct way, it still exists, entries still remain in /etc/mtab.
I think the patch I posted in #7 should be considered.
Created attachment 3905 [details]
canonicalize the path given to umount.cifs
This is the same patch in comment #7, redone with the umount.cifs.c in
Created attachment 3906 [details]
canonicalize the path supplied to umount.cifs command
A different definition of function canonicalize, using the same one in smbumount.
This patch has been committed to master for some time. Closing case.