From owner-freebsd-hackers Tue Jan 30 16: 2:35 2001 Delivered-To: freebsd-hackers@freebsd.org Received: from isua3.iastate.edu (isua3.iastate.edu [129.186.1.139]) by hub.freebsd.org (Postfix) with ESMTP id AA02D37B69C for ; Tue, 30 Jan 2001 16:02:16 -0800 (PST) Received: from localhost (ccsanady@localhost) by isua3.iastate.edu (8.8.8/8.8.5) with SMTP id SAA27885; Tue, 30 Jan 2001 18:02:15 -0600 (CST) Message-Id: <200101310002.SAA27885@isua3.iastate.edu> To: freebsd-hackers@freebsd.org, arla-drinkers@stacken.kth.se Cc: Love Subject: Re: FreeBSD Linux emulation / arla 0.34.6 In-reply-to: Your message of 29 Jan 2001 03:20:08 +0100. Date: Tue, 30 Jan 2001 18:02:15 CST From: Chris Csanady Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG >Chris 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