Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 Jan 2001 18:02:15 CST
From:      Chris Csanady <ccsanady@iastate.edu>
To:        freebsd-hackers@freebsd.org, arla-drinkers@stacken.kth.se
Cc:        Love <lha@stacken.kth.se>
Subject:   Re: FreeBSD Linux emulation / arla 0.34.6 
Message-ID:  <200101310002.SAA27885@isua3.iastate.edu>
In-Reply-To: Your message of 29 Jan 2001 03:20:08 %2B0100. <am1ytnumjr.fsf@mom.e.kth.se> 

next in thread | previous in thread | raw e-mail | index | archive | help

>Chris <cc@137.org> writes:
>
>> I have discovered a rather interesting bug with this combination,
>> and was wondering if anyone could point me in the right direction
>> to help me track it down.
>> 
>> The problem is that linux binaries which call getdirents on an afs
>> directory do not report the last directory entry:
>> 
>> /afs/whatever% /bin/ls -f
>> 1       2       3       4
>> /afs/whatever% /compat/linux/bin/ls
>> 1  2  3
>
>The patch below for arla fixes the problem.
> 
>> I believe that this might also be what is causing linux-netscape
>> to wedge the machine (with home directories on afs), although I'm
>> not positive.

This patch does fix the directory problem, but apparently not the
netscape wedging problem.  Anyways, I have tracked it down I think,
but I'm not positive about the fix.

The problem appears to be xfs_readdir getting passed a directory
that contains an entry with dp->d_reclen zero--then it gets stuck
infinitely looping here.

Chris

*** xfs_vnodeops-bsd.c.old      Tue Jan 30 16:58:04 2001
--- xfs_vnodeops-bsd.c  Tue Jan 30 16:59:23 2001
***************
*** 497,510 ****
        dp_end = (const struct dirent *) uio->uio_iov->iov_base;
        for (dp_start = dp, ncookies = 0;
             dp < dp_end;
!            dp = (const struct dirent *)((const char *) dp + dp->d_reclen))
            ncookies++;
  
        MALLOC(cookies, xfs_cookie_t *, ncookies * sizeof(xfs_cookie_t),
               M_TEMP, M_WAITOK);
        for (dp = dp_start, cookiep = cookies;
             dp < dp_end;
             dp = (const struct dirent *)((const char *) dp + dp->d_reclen)) {
            off += dp->d_reclen;
            *cookiep++ = off;
        }
--- 497,515 ----
        dp_end = (const struct dirent *) uio->uio_iov->iov_base;
        for (dp_start = dp, ncookies = 0;
             dp < dp_end;
!            dp = (const struct dirent *)((const char *) dp + dp->d_reclen)) {
            ncookies++;
+           if (dp->d_reclen == 0)
+               break;
+       }
  
        MALLOC(cookies, xfs_cookie_t *, ncookies * sizeof(xfs_cookie_t),
               M_TEMP, M_WAITOK);
        for (dp = dp_start, cookiep = cookies;
             dp < dp_end;
             dp = (const struct dirent *)((const char *) dp + dp->d_reclen)) {
+           if (dp->d_reclen == 0)
+               break;
            off += dp->d_reclen;
            *cookiep++ = off;
        }



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200101310002.SAA27885>