Error with umount.cifs: "This utility only unmounts cifs filesystems"

Right til today I used only the smbfs filesystem and the smbmount+smbumount commands to work with Windows shares. But some time ago I've found in one of the messages of smbmount that it's deprecated and I should use cifs instead. I've done as "instructed" Smile, but immediately found a bug during the umount process.

If you're just a single user, you've to use mount.cifs and umount.cifs for managing your CIFS mountpoints. However after running the umount.cifs command, mount still listed the given share as mounted.

The mount command just shows the contents of the /etc/mtab file (with a little formatting), so I checked /proc/mounts and saw that the umount was actually successful, only /etc/mtab was not updated.

Inspired by an old post (from 2006) I've been experimenting a bit and found a workaround.

If you use umount.cifs with a relative path for the mountpoint, then umount.cifs fails to remove the respective line from /etc/mtab:

testuser@linuxserver:~$ mkdir -p mnt/share
testuser@linuxserver:~$ mount.cifs //winserver/public mnt/share -o user=winuser,dom=win-domain
Password:
testuser@linuxserver:~$ cat /proc/mounts  | grep cifs
//winserver/public /home/testuser/mnt/share cifs rw,mand,nosuid,nodev,unc=\\winserver\public,username=winuser,domain=win-domain,uid=1002,gid=1002,rsize=16384,wsize=57344 0 0
testuser@linuxserver:~$ mount | grep cifs
//winserver/public on /home/testuser/mnt/share type cifs (rw,mand,nosuid,nodev,user=testuser)
testuser@linuxserver:~$ umount.cifs mnt/share
testuser@linuxserver:~$ cat /proc/mounts  | grep cifs
testuser@linuxserver:~$ mount | grep cifs
//winserver/public on /home/testuser/mnt/share type cifs (rw,mand,nosuid,nodev,user=testuser)

However using an absolute path for the mountpoint works as expected:
testuser@linuxserver:~$ mount.cifs //winserver/public mnt/share -o user=winuser,dom=win-domain
Password:
testuser@linuxserver:~$ cat /proc/mounts  | grep cifs
//winserver/public /home/testuser/mnt/share cifs rw,mand,nosuid,nodev,unc=\\winserver\public,username=winuser,domain=win-domain,uid=1002,gid=1002,rsize=16384,wsize=57344 0 0
testuser@linuxserver:~$ mount | grep cifs
//winserver/public on /home/testuser/mnt/share type cifs (rw,mand,nosuid,nodev,user=testuser)
testuser@linuxserver:~$ umount.cifs /home/testuser/mnt/share
testuser@linuxserver:~$ cat /proc/mounts  | grep cifs
testuser@linuxserver:~$ mount | grep cifs

So only umount.cifs is flawed and only if you're using a relative path.

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

really a bug

But the guys at samba are slow on this one:
https://bugzilla.samba.org/show_bug.cgi?id=4370