This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: getdents64 problem


Jakub Jelinek wrote:
> 
> On Fri, Jan 19, 2001 at 11:25:30AM +0100, Andreas Jaeger wrote:
> >
> > There was yesterday a thread on linux kernel with subject "nfs client
> > problem in kernel 2.4.0" which noticed some problems with our getdents
> > implementation.
> >
> > Is the following patch ok?  Mogens, does it fix the problems you
> > noticed?
> 
> At least my understanding was that the problem is the opposite of what
> you're doing here:
> last kernel_dirent64 entry given from kernel is
> { ?, 0xffffffffULL, ?, ?, ? }
> and thus
> (sizeof (dp->d_off) != sizeof (kdp->d_off) && dp->d_off != d_off)
> check fails (it would succeed if kernel gave { ?, -1LL, ?, ?, ? } instead),
> which means (as last_offset != -1 at that point) that we just seek before
> this entry and return. On next getdents call, we read
> { ?, 0xffffffffULL, ?, ?, ? }
> once again and as last_offset is now -1 (no matter what your patch does), we
> return EOVERFLOW since we were not able to convert the last entry into
> struct dirent (4GB-1 does not fit into <-2GB,2GB-1> range).
> So, I think this is a kernel bug which glibc cannot do anything about
> (silently accepting d_off which would not fit would be IMHO a bad thing).

I think Jakub is right, it won't help. But I'll give it a try.

At least I can use my own "patch" while Trond is working on a more
general solution. I simply tread this "-1" as a special case:


*** getdents.c  Thu Jan 18 14:58:26 2001
--- getdents.c.ORIG     Fri Jan 19 12:31:19 2001
***************
*** 157,165 ****
              if ((sizeof (dp->d_ino) != sizeof (kdp->d_ino)
                   && dp->d_ino != d_ino)
                  || (sizeof (dp->d_off) != sizeof (kdp->d_off)
!                     && (dp->d_off != d_off && dp->d_off != -1)))
                {
-                 /* MK patch for d_off == -1 */
                  /* Overflow.  If there was at least one entry
                     before this one, return them without error,
                     otherwise signal overflow.  */
--- 157,164 ----
              if ((sizeof (dp->d_ino) != sizeof (kdp->d_ino)
                   && dp->d_ino != d_ino)
                  || (sizeof (dp->d_off) != sizeof (kdp->d_off)
!                     && dp->d_off != d_off))
                {
                  /* Overflow.  If there was at least one entry
                     before this one, return them without error,
                     otherwise signal overflow.  */

I've got a request from yusufg@outblaze.com, he has a more-or-less
similar
problem with a maxtor fileserver. The problem is described on
http://nfs.achan.com/. I've asked him to get some debug information that
might
tell us if the problems are related.

Thanks for investigating this!

Mogens

-- 
Mogens Kjaer, Carlsberg Laboratory, Dept. of Chemistry
Gamle Carlsberg Vej 10, DK-2500 Valby, Denmark
Phone: +45 33 27 53 25, Fax: +45 33 27 47 08
Email: mk@crc.dk Homepage: http://www.crc.dk

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]