From [email protected]  Sun Jul  2 08:04:40 1995
Return-Path: [email protected]
Received: from coli-gate.coli.uni-sb.de ([email protected] [134.96.68.11]) by jurix.jura.uni-sb.de (8.6.12/8.6.9) with ESMTP id IAA19794 for <[email protected]>; Sun, 2 Jul 1995 08:04:37 +0200
Received: from vger.rutgers.edu ([email protected] [128.6.190.2]) by coli-gate.coli.uni-sb.de (8.6.10/8.6.4) with ESMTP id IAA10990 for <[email protected]>; Sun, 2 Jul 1995 08:04:11 +0200
Received: (from majordomo@localhost) by vger.rutgers.edu (8.6.12/8.6.12) id BAA27742 for linux-gcc-outgoing; Sun, 2 Jul 1995 01:19:57 -0400
X-Authentication-Warning: vger.rutgers.edu: Processed from queue /var/spool/mqueue_post
From: [email protected] (H.J. Lu)
Message-Id: <[email protected]>
Subject: Re: Kernel 1.3.3 and NFS
To: [email protected] (Temptation)
Date: Sun, 2 Jul 95 1:03:15 EDT
Cc: [email protected] (linuxgcc), [email protected] (David Bonn),
       [email protected] (Kenneth Albanowski),
       [email protected] (Kenneth Osterberg), [email protected],
       [email protected] (Mat Hostetter), [email protected] (Eric C. Newton),
       [email protected] (Andy Dougherty),
       [email protected] (Brian Bourgault),
       [email protected] (John W. Christy),
       [email protected] (Craig Groeschel), [email protected] (Warner Losh),
       [email protected] (Rob Farnum), [email protected] (Huw Rogers),
       [email protected] (Michael Meissner)
In-Reply-To: <[email protected]>; from "Temptation" at Jul 1, 95 11:33 pm
X-Mailer: ELM [version 2.3 PL11]
Sender: [email protected]
Precedence: bulk
Status: RO

>
>
> Speaking about NFS, here is what I have found.
> Running 1.3.6 and all HJ's ELF bins from /private/...
> (my NFS mounts always worked before by the way)
> I've tried compiling different version of NFS, new and old, and the bins
> from Slackware-beta-ELF  (Eg. nfs-server-2.2beta2.tar was the newest I've
> tried) all of them would compile, and run, but when I tried to do an ls
> on a mount that had files it would hang, if the dir had no files, it
> worked.  anyways it was rpc.nfsd. everytime I compile it as ELF, it would
> hang ls. I didn't try compiling as a.out, but I have an old rpc.nfsd that
> is a.out and it works when I run rpc.portmap and rpc.mountd as ELF
> compiled.
>
> If you knew all this already, forget I said anything, I just didn't see a
> patch or a fix for it yet.
>

Oooooops. Red faced :-(. Please try this patch on libc 5.2.0.

Thanks for the bug report. If someone had made a small test case,
I wouldn't have downloaded the NFSD just to check out this bug :-).


H.J.
===================================================================
RCS file: /home/cvs/linux/libc/sysdeps/linux/seekdir.c,v
retrieving revision 1.3
diff -c -r1.3 seekdir.c
*** 1.3 1995/06/29 03:13:17
--- seekdir.c   1995/07/02 04:55:30
***************
*** 20,39 ****
     return;
   }

   switch (dir->dd_getdents)
   {
   case no_getdents:
   case have_getdents:
-     dir->dd_nextloc = lseek(dir->dd_fd, offset, SEEK_SET);
-     dir->dd_size = dir->dd_nextloc = 0;
-     break;
-
-   /* We don't have to do anything since no readdir () is called yet. */
   case unknown:
     break;

   default:
     errno = EBADF;
     break;
   }
 }
--- 20,41 ----
     return;
   }

+ #if 0
   switch (dir->dd_getdents)
   {
   case no_getdents:
   case have_getdents:
   case unknown:
+     dir->dd_nextoff = lseek(dir->dd_fd, offset, SEEK_SET);
+     dir->dd_size = dir->dd_nextloc = 0;
     break;

   default:
     errno = EBADF;
     break;
   }
+ #else
+   dir->dd_nextoff = lseek(dir->dd_fd, offset, SEEK_SET);
+   dir->dd_size = dir->dd_nextloc = 0;
+ #endif
 }
===================================================================
RCS file: /home/cvs/linux/libc/sysdeps/linux/telldir.c,v
retrieving revision 1.3
diff -c -r1.3 telldir.c
*** 1.3 1995/06/29 03:13:21
--- telldir.c   1995/07/02 04:54:04
***************
*** 23,39 ****

   switch (dir->dd_getdents)
   {
-   case unknown:
-     /* readdir () is not called yet. */
-     offset = 0;
-     break;
-
   case no_getdents:
     /* We are running the old kernel. This is the starting offset
        of the next readdir(). */
     offset = lseek(dir->dd_fd, 0, SEEK_CUR);
     break;

   case have_getdents:
     /* The next entry. */
     offset = dir->dd_nextoff;
--- 23,36 ----

   switch (dir->dd_getdents)
   {
   case no_getdents:
     /* We are running the old kernel. This is the starting offset
        of the next readdir(). */
     offset = lseek(dir->dd_fd, 0, SEEK_CUR);
     break;

+   case unknown:
+     /* readdir () is not called yet. but seekdir () may be called. */
   case have_getdents:
     /* The next entry. */
     offset = dir->dd_nextoff;