Problem with smbmount failure handling

Gavriel State ccijcrkf at umail.corel.com
Tue Nov 9 02:20:29 GMT 1999


We've recently noticed an issue with smbmount when it fails to mount a share
for whatever reason (bad password, bad share name, etc).  It attempts to back
out and umount the mount point, but fails to do so.  The mount point is left 
in a weird state where we get i/o errors for pretty much any file system 
activity.  At this point, doing an smbumount will half-fix the problem, but
an entry is still left in /etc/mtab unless root does a real umount.

I'm not entirely certain whether this failure is due to a configuration issue
on our end, or a problem with smbmount itself.  We're using 2.0.5a on a 
debian 2.1 (slink) based system.  Haven't checked 2.06-pre yet.

It looks as though smbmount is trying to call umount, but that call is failing
since smbmount isn't setuid root (should it be?):

$ smbmount /\/\gavriels_nt4/k mounter -W CORELCORP
Added interface ip=120.1.99.39 bcast=120.255.255.255 nmask=255.0.0.0
Got a positive name query response from 120.1.20.181 ( 120.1.15.50 )
Password:
tree connect failed: ERRDOS - ERRnosuchshare (You specified an invalid share name)
smbmount: login failed
Could not umount /home/gavriels/mounter: Operation not permitted
smbmount: exit

If it's run as root (or the binary is chmod +s'ed) we get:
$ smbmount /\/\gavriels_nt4/k mounter -W CORELCORP
Added interface ip=120.1.99.39 bcast=120.255.255.255 nmask=255.0.0.0
Got a positive name query response from 120.1.20.181 ( 120.1.15.50 )
Password:
tree connect failed: ERRDOS - ERRnosuchshare (You specified an invalid share name)
smbmount: login failed
Could not umount /home/gavriels/mounter: Device or resource busy
smbmount: exit

I don't understand the smbmount code well enough to fully understand what's 
going on here, but could the daemon process still have a file handle open or
something when the umount call gets made in smb_umount()?

Anyhow, we're getting around this using a wrapper layer (which is setuid root) 
that checks the success of an exec-ed smbmount operation and execs an smbumount
and a umount if it finds any funny IO errors.  It's not pretty, but it works.

-Gav

-- 
Gavriel State
Engineering Architect - Linux Development
Corel Corp
gavriels at corel.com


More information about the samba-technical mailing list