[8] in linux-net channel archive

home help back first fref pref prev next nref lref last post

Re: old mount ??? bug in nfs ???? bug in new kernel ????? FEATURE ????

daemon@ATHENA.MIT.EDU (Swen Thuemmler)
Tue Dec 20 04:12:20 1994

Date: Tue, 20 Dec 1994 09:20:39 +0100 (MET)
From: Swen Thuemmler <swen@uni-paderborn.de>
To: Linux Activists <linux-activists@niksula.hut.fi>
Cc: Linux Kernel <linux-kernel@vger.rutgers.edu>,
        Linux Net <linux-net@vger.rutgers.edu>
In-Reply-To: <94Dec19.180815eet.46339-3@niksula.hut.fi>

X-Mn-Key: NET

On Mon, 19 Dec 1994, Jacek Zapala wrote:

> I have observed strange behavior of the mount command from the old
> Slackware. I am trying to mount the nfs filesystem from the host which is
> the router and therefore it has two addresses: 1.2.3.5 and 1.2.2.5. My
> address is 1.2.3.4. With the new kernel (1.1.72), if named gives 1.2.3.5 as
> the first address of that host, and 1.2.2.5 as the second one, there are no
> problems. But if 1.2.2.5 is the first reported address, mount hangs up. With
> the old kernel everything is ok in both cases.
> 
> So what's the real problem ? Do I need newer mount ? 

This is a bug in the kernel. Unfortunately, fixing it requires a change 
of the mount program: just remove the connect() in line 350 of nfsmount.c 
(mount is part of util-linux). Same holds for mount_linux.c of amd. But 
beware! This mount (or amd) will not be compatible with older kernels, 
which require a connect()ed socked. The old mount will continue to work, 
so I hope this patch will eventually make it into the official kernel. 
This would give the possibility to do the right thing in the mount program 
depending on the kernel revision. Linus?

Ok, here's the kernel patch:

diff -u -r linux/fs/nfs/inode.c linux.new/fs/nfs/inode.c
--- linux/fs/nfs/inode.c	Sun Oct 23 18:35:37 1994
+++ linux.new/fs/nfs/inode.c	Mon Nov 28 20:50:50 1994
@@ -116,6 +116,7 @@
 	server->acdirmin = data->acdirmin*HZ;
 	server->acdirmax = data->acdirmax*HZ;
 	strcpy(server->hostname, data->hostname);
+	memcpy(&server->addr, &data->addr, sizeof(struct sockaddr_in));
 	sb->u.nfs_sb.s_root = data->root;
 	unlock_super(sb);
 	if (!(sb->s_mounted = nfs_fhget(sb, &data->root, NULL))) {
diff -u -r linux/fs/nfs/sock.c linux.new/fs/nfs/sock.c
--- linux/fs/nfs/sock.c	Fri Oct  7 08:12:32 1994
+++ linux.new/fs/nfs/sock.c	Mon Nov 28 20:54:26 1994
@@ -102,7 +102,7 @@
 	fs = get_fs();
 	set_fs(get_ds());
 	for (n = 0, timeout = init_timeout; ; n++, timeout <<= 1) {
-		result = sock->ops->send(sock, (void *) start, len, 0, 0);
+		result = sock->ops->sendto(sock, (void *) start, len, 0, 0, (struct sockaddr *)&server->addr, sizeof(server->addr));
 		if (result < 0) {
 			printk("nfs_rpc_call: send error = %d\n", result);
 			break;
@@ -162,7 +162,7 @@
 		 * we don't now need, so discard it */
 		result = sock->ops->recvfrom(sock, (void *)&recv_xid,
 					     sizeof(recv_xid), 1, MSG_PEEK,
-					     NULL, &addrlen);
+					     (struct sockaddr *)&server->addr, &addrlen);
 		if (result < 0) {
 			if (result == -EAGAIN) {
 #if 0
@@ -192,7 +192,7 @@
 		 * again.  What a hack! but I can't call recvfrom with
 		 * a null buffer yet. */
 		(void)sock->ops->recvfrom(sock, (void *)&recv_xid,
-					  sizeof(recv_xid), 1, 0, NULL,
+					  sizeof(recv_xid), 1, 0, (struct sockaddr *)&server->addr,
 					  &addrlen);
 #if 0
 		printk("nfs_rpc_call: XID mismatch\n");
@@ -206,7 +206,7 @@
 	 *
 	 */
 	result=sock->ops->recvfrom(sock, (void *)start, 
-				  size + 1024, 1, 0, NULL,
+				  size + 1024, 1, 0, (struct sockaddr *)&server->addr,
 			/* Here is NFS_SLACK_SPACE..., hack */
 				  &addrlen);
 	if (result < 0) {
diff -u -r linux/include/linux/nfs_fs_sb.h linux.new/include/linux/nfs_fs_sb.h
--- linux/include/linux/nfs_fs_sb.h	Wed Dec  1 13:44:15 1993
+++ linux.new/include/linux/nfs_fs_sb.h	Mon Nov 28 21:02:11 1994
@@ -2,6 +2,7 @@
 #define _NFS_FS_SB
 
 #include <linux/nfs.h>
+#include <linux/in.h>
 
 struct nfs_server {
 	struct file *file;
@@ -17,6 +18,7 @@
 	int acdirmin;
 	int acdirmax;
 	char hostname[256];
+	struct sockaddr_in addr;
 };
 
 /*




home help back first fref pref prev next nref lref last post