smbmount problem

Paul PELaufer at csupomona.edu
Sun Jan 31 06:02:48 GMT 1999


Hi,
	This is regarding the userland smbfs utils included with Samba 2.0 
for use with Linux kernel 2.1 and 2.2.
	The other day I noticed that smbmount processes don't die when the
mounted share is unmounted with either smbumount (as user) or umount (as
root). I enabled smbfs debugging in the kernel and found that the kernel
was sending its signals to the daemon's parent. Upon examining the
smbmount code I found that smbmount mounts the share before daemonizing.
Thus the kernel thinks that the parent smbmount process is handling
things, and knows nothing about the daemon. So when the share is unmounted
the kernel sends SIGTERM to the wrong PID, and the daemon just sits there.
What's worse is the daemon wont be able to help the kernel if it needs
something (the kernel sends SIGUSR1).
	There is a comment in smbmount's code explaining why the mount is
done first:
        /*
         * Create the background process after trying the mount.
         * to avoid race conditions with automount and other processes.
         */

What exactly causes this race? Does the problem lie in the chance of the
parent returning before the deamon finishes the mount? If so, wouldn't it
be possible for the parent to pause() and wait for the daemon to send it
SIGTERM after it has completed the mount and the kernel would then have
the proper PID? Or is it something else?  Please forgive me for any
ignorance, I'm fairly new to this.

Paul Laufer



More information about the samba-technical mailing list