From owner-gcc@vger.rutgers.edu  Sun Jul  2 08:04:40 1995
Return-Path: owner-gcc@vger.rutgers.edu
Received: from coli-gate.coli.uni-sb.de (root@coli-gate.coli.uni-sb.de [134.96.68.11]) by jurix.jura.uni-sb.de (8.6.12/8.6.9) with ESMTP id IAA19794 for <florian@jurix.jura.uni-sb.de>; Sun, 2 Jul 1995 08:04:37 +0200
Received: from vger.rutgers.edu (majordomo@vger.rutgers.edu [128.6.190.2]) by coli-gate.coli.uni-sb.de (8.6.10/8.6.4) with ESMTP id IAA10990 for <flla@CoLi.Uni-SB.DE>; 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: hjl@nynexst.com (H.J. Lu)
Message-Id: <9507020503.AA12810@texas.nynexst.com>
Subject: Re: Kernel 1.3.3 and NFS
To: temp@temptation.interlog.com (Temptation)
Date: Sun, 2 Jul 95 1:03:15 EDT
Cc: linux-gcc@vger.rutgers.edu (linuxgcc), bonn@eskimo.com (David Bonn),
        kjahds@kjahds.com (Kenneth Albanowski),
        lmfken@lmf.ericsson.se (Kenneth Osterberg), ian@lasermoon.co.uk,
        mat@ardi.com (Mat Hostetter), ecn@clark.net (Eric C. Newton),
        doughera@lafcol.lafayette.edu (Andy Dougherty),
        brian@mathworks.com (Brian Bourgault),
        jchristy@bga.com (John W. Christy),
        craig@metrolink.com (Craig Groeschel), imp@village.org (Warner Losh),
        robf@www.willows.com (Rob Farnum), Huw.Rogers@ska.com (Huw Rogers),
        meissner@cygnus.com (Michael Meissner)
In-Reply-To: <Pine.LNX.3.91.950701232128.6071A-100000@temptation.interlog.com>; from "Temptation" at Jul 1, 95 11:33 pm
X-Mailer: ELM [version 2.3 PL11]
Sender: owner-gcc@vger.rutgers.edu
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;

