umount.cifs doesn't remove entry from /etc/mtab

Bug #175527 reported by Chow Loong Jin
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
samba
Fix Released
Medium
samba (Ubuntu)
Fix Released
Low
Chuck Short
Declined for Hardy by Thierry Carrez

Bug Description

Binary package hint: smbfs

I think it can be best summarized by the following console output:

hyperair@Hyperair-PC:~/test$ mount.cifs //localhost/Videos ./mnt
Password:
hyperair@Hyperair-PC:~/test$ mount
/dev/sda1 on / type ext3 (rw,noatime,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
lrm on /lib/modules/2.6.22-14-generic/volatile type tmpfs (rw)
/dev/sdc1 on /home type ext3 (rw,noatime)
/dev/sdb1 on /home/hyperair/Music type ext3 (rw,noatime)
/dev/sda3 on /home/hyperair/Videos type ext3 (rw,noatime)
securityfs on /sys/kernel/security type securityfs (rw)
rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
//localhost/Videos on /home/hyperair/test/mnt type cifs (rw,mand,nosuid,nodev,user=hyperair)
hyperair@Hyperair-PC:~/test$ umount.cifs ./mnt
hyperair@Hyperair-PC:~/test$ mount
/dev/sda1 on / type ext3 (rw,noatime,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
lrm on /lib/modules/2.6.22-14-generic/volatile type tmpfs (rw)
/dev/sdc1 on /home type ext3 (rw,noatime)
/dev/sdb1 on /home/hyperair/Music type ext3 (rw,noatime)
/dev/sda3 on /home/hyperair/Videos type ext3 (rw,noatime)
securityfs on /sys/kernel/security type securityfs (rw)
rpc_pipefs on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
//localhost/Videos on /home/hyperair/test/mnt type cifs (rw,mand,nosuid,nodev,user=hyperair)
hyperair@Hyperair-PC:~/test$

Any subsequent mounts and unmounts using mount.cifs and umount.cifs on the same directory will cause more entries to be deposited in /etc/mtab, and none of them will be removed short of using umount as root.

Revision history for this message
Chuck Short (zulcss) wrote :

Hello,

Thanks for the bug report. What does /proc/mounts say after going through this process?

Thanks
chuck

Changed in samba:
assignee: nobody → zulcss
status: New → Incomplete
Revision history for this message
Chow Loong Jin (hyperair) wrote :

/proc/mounts works as expected. It's just /etc/mtab isn't updated accordingly.

Chuck Short (zulcss)
Changed in samba:
status: Incomplete → Triaged
Revision history for this message
Chuck Short (zulcss) wrote :

Hi,

Thanks for the information is this under hardy or a previous release. If its not hardy could you please download the iso and please test?

Thanks
chuck

Revision history for this message
Chow Loong Jin (hyperair) wrote :

It occurs on Hardy.

Revision history for this message
Steve Langasek (vorlon) wrote :

This appears to be a variant on a bug fixed in samba 3.0.25b-2:

  * cifs-umount-trailing-slashes.patch: canonicalize mount point names when
    umount.cifs is called, to avoid unnecessarily leaving entries behind in
    /etc/mtab if invoked with a trailing slash in the mount point name

Even with that fix, umount.cifs assumes that you will unmount using an absolute path rather than a relative path.

hyperair, as a workaround I recommend that you use the absolute path when unmounting cifs shares, until this can be resolved.

Revision history for this message
Chow Loong Jin (hyperair) wrote :

Alright, thanks for the tip.

Chuck Short (zulcss)
Changed in samba:
importance: Undecided → Low
Revision history for this message
mehturt (mehturt) wrote :

This problem still appears in 8.10.
There's a bug at samba's bugzilla about it https://bugzilla.samba.org/show_bug.cgi?id=4370 .

Changed in samba:
status: Unknown → Confirmed
Revision history for this message
Alex G (ogxela-yahoo) wrote :

I can confirm this occurs when there is a symlink in the mountpoint path as well, in Hardy with the latest updates.

alex@fuzzy:/home/SODAPOP$ ls -l
total 104K
lrwxrwxrwx 1 root root 23 2009-01-07 10:15 agottschalk -> ../AUTOHOME/agottschalk/

alex@fuzzy:~/scripts$ mount.cifs //grapeape/Users/AGottschalk /home/AUTOHOME/alex/winhome
Password:

alex@fuzzy:~/scripts$ cat /etc/mtab
[...]
automount(pid5177) /home/AUTOHOME autofs rw,fd=4,pgrp=5177,minproto=2,maxproto=4 0 0
//grapeape/Users /home/AUTOHOME/alex/winhome cifs rw,mand,nosuid,nodev,user=alex 0 0

alex@fuzzy:~/scripts$ umount.cifs /home/AUTOHOME/alex/winhome

alex@fuzzy:~/scripts$ cat /etc/mtab
[...]
automount(pid5177) /home/AUTOHOME autofs rw,fd=4,pgrp=5177,minproto=2,maxproto=4 0 0
peaches:/srv/autohomes/alex /home/AUTOHOME/alex nfs rw,nosuid,soft,addr=10.10.1.31 0 0

alex@fuzzy:~/scripts$ mount.cifs //grapeape/Users/AGottschalk /home/SODAPOP/alex/winhome
Password:

alex@fuzzy:~/scripts$ umount.cifs /home/SODAPOP/alex/winhome

alex@fuzzy:~/scripts$ cat /etc/mtab
[...]
automount(pid5177) /home/AUTOHOME autofs rw,fd=4,pgrp=5177,minproto=2,maxproto=4 0 0
peaches:/srv/autohomes/alex /home/AUTOHOME/alex nfs rw,nosuid,soft,addr=10.10.1.31 0 0
//grapeape/Users /home/AUTOHOME/alex/winhome cifs rw,mand,nosuid,nodev,user=alex 0 0

Changed in samba:
status: Confirmed → Fix Released
Revision history for this message
Thierry Carrez (ttx) wrote :

Fixed in 3.2.9 and 3.3.2, so this should be fixed in Jaunty release.

Changed in samba (Ubuntu):
status: Triaged → Fix Released
Revision history for this message
P.Constantine (pconstantine) wrote :

??
Maverick

$ sudo mount -o username=user,workgroup=company,umask=000,iocharset=utf8,uid=user,gid=user //netapp/public /media/public/

$ sudo umount /media/public

$ cat /etc/mtab | grep public
//netapp/public/ /media/public cifs rw,mand 0 0

Regression? Was never fixed in the first place?

I've tried it now and then since 7.04 and EACH time it was 100% reproducible.

Revision history for this message
P.Constantine (pconstantine) wrote :

Let's see, strace on umount gives us this:

2969 fstat64(3, {st_mode=S_IFREG|0644, st_size=754, ...}) = 0
2969 mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0xb775f000
2969 read(3, "/dev/sda1 / ext3 rw,errors=remou"..., 4096) = 754
2969 read(3, "", 4096) = 0
2969 close(3) = 0
2969 munmap(0xb775f000, 4096) = 0
2969 stat64("/sbin/umount.cifs", 0xbfdaeb60) = -1 ENOENT (No such file or directory)
2969 oldumount("/media/public" <<<<--- it hangs here!

Let's see:

$ dpkg --search `which mount.cifs`
cifs-utils: /sbin/mount.cifs

$ # dpkg -L cifs-utils
/.
/sbin
/sbin/mount.cifs
/usr
/usr/sbin
/usr/sbin/cifs.upcall
/usr/share
/usr/share/man
/usr/share/man/man8
/usr/share/man/man8/mount.cifs.8.gz
/usr/share/man/man8/cifs.upcall.8.gz
/usr/share/doc
/usr/share/doc/cifs-utils
/usr/share/doc/cifs-utils/copyright
/usr/share/doc/cifs-utils/NEWS.Debian.gz
/usr/share/doc/cifs-utils/changelog.gz
/usr/share/doc/cifs-utils/changelog.Debian.gz

$ dpkg -L smbfs
/.
/sbin
/sbin/mount.smbfs
/usr
/usr/share
/usr/share/doc
/usr/share/doc/smbfs
/usr/share/doc/smbfs/copyright
/usr/share/doc/smbfs/changelog.gz
/usr/share/doc/smbfs/changelog.Debian.gz
/usr/share/man
/usr/share/man/man8
/usr/bin
/usr/share/man/man8/mount.smbfs.8.gz
/usr/share/man/man8/smbmount.8.gz
/usr/bin/smbmount

As you can see 'umount.cifs' is indeed nowhere to be found.

Revision history for this message
P.Constantine (pconstantine) wrote :

Aha, it does unmount correctly after a lot of time inside oldumount()
This never happens when mounting with no trailing slash.

Changed in samba:
importance: Unknown → Medium
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.