>Chris <[EMAIL PROTECTED]> 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 [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to