Disappearing Mounts

Urban Widmark urban at teststation.com
Thu Jan 4 20:19:13 GMT 2001


On Thu, 4 Jan 2001, Winston Nchamukong wrote:

> I wish to report a problem that I have been experiencing with Samba versions
> 2.0.6 and 2.7. The specific problem concerns mounting windows shares on our
> Linux machines running Linux 6.2. These shares are mounted using the mount

RedHat 6.2? with kernel 2.2.12 or so?

You should upgrade to 2.2.18, it works around a common problem where
signals are causing smbfs mounts to become unusable. Kernels earlier than
2.2.17 have nasty machine-crashing (possibly even data corrupting) bugs in
smbfs (you need to try a bit to trigger them, but they are definitly
there).

Even so, 2.2.18 isn't really ok. At least one person have reported that
multithreaded programs run under gdb or strace will cause smbmount to
fail. If you try 2.2.18 and still see problems, try adding this patch.
(It's a better fix than what's in 2.2.18, except that it disables SIGKILL
 so it _may_ be possible to get programs to hang and not be able to kill
 them ...)

This is a very common problem, I suspect you have lines like this in your
syslog files:
smb_retry: caught signal

/Urban


--- linux-2.2.18-orig/fs/smbfs/sock.c	Wed Dec 13 21:27:44 2000
+++ linux/fs/smbfs/sock.c	Tue Jan  2 21:19:03 2001
@@ -30,11 +30,13 @@
 
 static int
 _recvfrom(struct socket *socket, unsigned char *ubuf, int size,
-	  unsigned flags)
+	  unsigned rflags)
 {
 	struct iovec iov;
 	struct msghdr msg;
 	struct scm_cookie scm;
+	sigset_t old_set;
+	unsigned long flags;
 
 	msg.msg_name = NULL;
 	msg.msg_namelen = 0;
@@ -43,11 +45,33 @@
 	msg.msg_control = NULL;
 	iov.iov_base = ubuf;
 	iov.iov_len = size;
-	
+
 	memset(&scm, 0,sizeof(scm));
-	size=socket->ops->recvmsg(socket, &msg, size, flags, &scm);
-	if(size>=0)
-		scm_recv(socket,&msg,&scm,flags);
+
+	/*
+	 * block all signals to avoid -ERESTARTSYS problem in recvmsg
+	 *
+	 * FIXME: changing the signal mask is done elsewhere too.
+	 * This code removes the ability to SIGKILL a process that has hung in
+	 * recvmsg (does it? I'm guessing ...).
+	 * Use poll/timeout to ensure progress?
+	 */
+	spin_lock_irqsave(&current->sigmask_lock, flags);
+	old_set = current->blocked;
+	siginitsetinv(&current->blocked, 0);
+	recalc_sigpending(current);
+	spin_unlock_irqrestore(&current->sigmask_lock, flags);
+
+	size = socket->ops->recvmsg(socket, &msg, size, rflags, &scm);
+	if (size >= 0)
+		scm_recv(socket, &msg, &scm, rflags);
+
+	/* restore old signal mask */
+	spin_lock_irqsave(&current->sigmask_lock, flags);
+	current->blocked = old_set;
+	recalc_sigpending(current);
+	spin_unlock_irqrestore(&current->sigmask_lock, flags);
+
 	return size;
 }
 
@@ -529,7 +553,7 @@
 				buf_len = server->packet_size;
 			buf_len = smb_round_length(buf_len);
 			if (buf_len > SMB_MAX_PACKET_SIZE)
-				goto out_no_mem;
+				goto out_too_long;
 
 			rcv_buf = smb_vmalloc(buf_len);
 			if (!rcv_buf)





More information about the samba mailing list