[patch] smbmount dies when server dies

Urban Widmark urban at svenskatest.se
Wed May 31 17:27:42 GMT 2000


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 //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