[patch] smbmount dies when server dies

Reid Sutherland reid at isys.ca
Thu Jun 1 02:33:46 GMT 2000


Well that takes care of one headache with smbmount.

Now I'm very naive when it comes to how Samba's internals work, so please
bare with me.

Can't smbmount work like nfs? In the sense that it can re-establish broken
connections on the fly, when the remote host is alive again and nfsd is
started and working.
Does smbmount not send keepalive packets every, say, 30 seconds or so? If
no, is it because of a limitation in Windows (doubt it, mapping network
drives works ok)?
If a keepalive type packet is sent, how difficult is it then to check to see
if the share is there or not, and to reconnect to it if it comes back after
being offline?

Now I've just started using Samba to connect to NT machines, and I have been
using it for quite some time to make win32 machines connect to unix based
machine. That scenerio I have no problems with. With this said I've never
really checked out smbclient. All I know is it's like a limited ftp program.
And that's why I'm trying to use smbmount instead.

Thanks for all your help.

-reid
----- Original Message -----
From: Urban Widmark <urban at svenskatest.se>
To: Andrew Tridgell <tridge at linuxcare.com>
Cc: Reid Sutherland <reid at isys.ca>; Multiple recipients of list SAMBA
<samba at samba.org>
Sent: Wednesday, May 31, 2000 1:27 PM
Subject: [patch] smbmount dies when server dies


>
> Hello
>
> There have been a few reports on mounted shares that stop working, some of
> these mention that the server was rebooted. There are probably other
> reasons for some of the problems, but here is a patch for one smbmount
> problem. But first a desciption of the problem it tries to fix.
>
> samba-2.0.7 on both ends. client is 2.4.0-test1-ac2 + patch to make smbfs
> behave like in 2.2.16-pre (shouldn't matter at all)
>
> client server (b, exports the share la)
> ------ ------
> # /usr/local/samba/bin/smbd
> # mount -t smbfs file://b/la /ha
> # ls -al /ha
> total 1
> ...
> # ps -e | grep smb
> 16135 ?        00:00:00 mount.smbfs
> # killall smbd
>   (pretend the server died)
> # ls -al /ha
>    (after a longish delay)
> ls: /ha: Input/output error
> # ps -e | grep smb
> #
>
> Nothing! smbmount is gone, starting the smbd on the server will not
> help since smbfs needs the now dead smbmount to reconnect it.
>
> # umount /ha
>
> Recompile, after applying the patch below, install and repeat the above
> steps ... here is the important difference:
> # killall smbd
> # ls -al /ha
>    (after a longish delay)
> ls: /ha: Input/output error
> # ps -e | grep smb
> 17308 ?        00:00:00 mount.smbfs
>
> It's still around! Starting the smbd again could make the connection work
> again ... and it does.
>
> # /usr/local/samba/bin/smbd
> # ls -al /ha
> total 1
> ...
>
> It also works if I bring the server box down and then up (the delay before
> claiming an error on ls becomes longer). I have not tested this vs a
> rebooting windows box, but it should be the same.
>
> /Urban
>
>
> --- samba-2.0.7-orig/source/client/smbmount.c Wed Apr 26 01:06:42 2000
> +++ samba-2.0.7/source/client/smbmount.c Wed May 31 18:32:40 2000
> @@ -342,13 +342,17 @@
>   }
>  #endif
>
> - /* Wait for a signal from smbfs ... */
> - CatchSignal(SIGUSR1, &usr1_handler);
> - pause();
> + /* Wait for a signal from smbfs ... but don't continue
> +                   until we actually get a new connection. */
> + c = NULL;
> + while (!c) {
> +     CatchSignal(SIGUSR1, &usr1_handler);
> +     pause();
>  #ifdef SMBFS_DEBUG
> - DEBUG(2,("mount.smbfs: got signal, getting new socket\n"));
> +     DEBUG(2,("mount.smbfs: got signal, getting new socket\n"));
>  #endif
> - c = do_connection(service);
> +     c = do_connection(service);
> + }
>   }
>
>   smb_umount(mount_point);
>
>



More information about the samba mailing list