NFS causes 2.0.33 seg fault, patches at 11

David Schleef (ds@stm.lbl.gov)
Fri, 3 Apr 1998 12:41:04 -0800 (PST)


I use an NFS server that returns invalid file types in the nfs_fattr
structure that is returned by some nfs protocol calls. I assume that
this is incorrect behavior for the server, but it causes 2.0.33 to
seg fault. Seg faults are not cool, and it is easy to guess what the
server meant, so I wrote patches for 2.0.33 and 2.1.92.

If there is someone taking care of the NFS code, could you 1) put your
name in the maintainers file so that I can find you next time and 2)
let me know that you got the patch.

dave...

Patch for 2.0.33:

--- linux/fs/nfs/dir.c.orig Fri Apr 3 12:16:47 1998
+++ linux/fs/nfs/dir.c Fri Apr 3 12:19:07 1998
@@ -693,7 +693,17 @@
return;
}
was_empty = (inode->i_mode == 0);
- inode->i_mode = fattr->mode;
+
+ /*
+ * Some (broken?) NFS servers return 0 as the file type.
+ * We'll assume that 0 means the file type has not changed.
+ */
+ if(!(fattr->mode & S_IFMT)){
+ inode->i_mode = (inode->i_mode & S_IFMT) |
+ (fattr->mode & ~S_IFMT);
+ }else{
+ inode->i_mode = fattr->mode;
+ }
inode->i_nlink = fattr->nlink;
inode->i_uid = fattr->uid;
inode->i_gid = fattr->gid;

Patch for 2.1.92:

--- linux/fs/nfs/inode.c.orig Tue Mar 10 13:31:22 1998
+++ linux/fs/nfs/inode.c Fri Apr 3 12:14:15 1998
@@ -731,8 +731,13 @@

/*
* Make sure the inode's type hasn't changed.
+ *
+ * Some (broken?) NFS servers return 0 as the file type.
+ * We'll just assume that 0 means that the type has not
+ * changed.
*/
- if ((inode->i_mode & S_IFMT) != (fattr->mode & S_IFMT))
+ if ( ((inode->i_mode & S_IFMT) != (fattr->mode & S_IFMT))
+ && ((fattr->mode & S_IFMT) != 0 ) )
goto out_changed;

/*

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu