Re: FreeBSD Linux emulation / arla 0.34.6

2001-01-30 Thread Love

Chris Csanady <[EMAIL PROTECTED]> writes:

> >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.

Yes, that is definitely a bug in xfs. It's also a bug in arlad. Can you add
`printf ("name: %s %d\n", dp->d_name, dp->d_reclen)' in one of the cookie
loops too find what directory that is corrupted.

The try to find the file in arla's cache directory. The converted
directory's filename ends with '@' and will contain the information that
the kernel reads. Then try to parse the file, or send it to
({lha,map,assar}@stacken.kth.se) and we'll try to figure out why it
happens.

I've commited your patch. Thanks.

Love


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: FreeBSD Linux emulation / arla 0.34.6

2001-01-30 Thread Chris Csanady


>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



Re: FreeBSD Linux emulation / arla 0.34.6

2001-01-28 Thread Chris Csanady


>The problem is that linux_getdents uses a little too small buffer, arla
>uses (before the patch) a directory-blocksize of 1024 bytes. This make
>every entry that have its end past a 512 bytes offset disapper when running
>under linux-emulation.
>
>Love

That was quick.  Really, I can't thank you enough for this..  This makes my
life considerably easier. :)

It seems kind of dangerous having these things hard coded--should the linux
compatibility code be fixed?  I notice that there is a

#define DIRBLKSIZ 512/* XXX we used to use ufs's DIRBLKSIZ */

at sys/compat/linux/linux_file.c:425.  It is not clear to me what this
should be though.

Anyways, thanks again,

Chris



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: FreeBSD Linux emulation / arla 0.34.6

2001-01-28 Thread Love

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.
> 
> Any ideas where to start the search for the offending code?

The problem is that linux_getdents uses a little too small buffer, arla
uses (before the patch) a directory-blocksize of 1024 bytes. This make
every entry that have its end past a 512 bytes offset disapper when running
under linux-emulation.

Love


Index: bsd-subr.c
===
RCS file: /afs/stacken.kth.se/src/SourceRepository/arla/arlad/bsd-subr.c,v
retrieving revision 1.55
retrieving revision 1.55.2.1
diff -u -w -u -w -r1.55 -r1.55.2.1
--- arlad/bsd-subr.c2000/10/14 19:58:04 1.55
+++ arlad/bsd-subr.c2001/01/29 02:02:17 1.55.2.1
@@ -44,7 +44,7 @@
 #ifdef __linux__
 #include 
 #else
-#define XFS_DIRENT_BLOCKSIZE 1024
+#define XFS_DIRENT_BLOCKSIZE 512
 #define xfs_dirent dirent
 #endif


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: FreeBSD Linux emulation / arla 0.34.6

2001-01-26 Thread Kris Kennaway

On Wed, Jan 24, 2001 at 10:15:53PM -0600, Chris Csanady wrote:
> 
> >On Wed, Jan 24, 2001 at 12:50:29PM -0600, Chris wrote:
> >> Silly me--I forgot to mention, this is with FreeBSD 4.2-STABLE.
> >
> >How recent -stable? A bug like this was fixed recently. If it's older
> >than a week, Try upgrading :-)
> >
> >Kris
> 
> Hmm, are you referring to this commit?  It appears to been MFC'd on
> 11/07, so I hope not. :)  I will rebuild and find out though..

That could be the one I'm thinking of.

Kris

-- 
NOTE: To fetch an updated copy of my GPG key which has not expired,
finger [EMAIL PROTECTED]

 PGP signature


Re: FreeBSD Linux emulation / arla 0.34.6

2001-01-24 Thread Chris Csanady


>On Wed, Jan 24, 2001 at 12:50:29PM -0600, Chris wrote:
>> Silly me--I forgot to mention, this is with FreeBSD 4.2-STABLE.
>
>How recent -stable? A bug like this was fixed recently. If it's older
>than a week, Try upgrading :-)
>
>Kris

Hmm, are you referring to this commit?  It appears to been MFC'd on
11/07, so I hope not. :)  I will rebuild and find out though..

Thanks,
Chris


marcel  2000/11/04 23:31:18 PST

  Modified files:
sys/compat/linux linux_file.c 
  Log:
  Fix getdents syscall.
  
  The offset field in struct dirent was set to the offset of
  the next dirent in rev 1.36. The offset was calculated from
  the current offset and the record length. This offset does
  not necessarily match the real offset when we are using
  cookies. Therefore, also use the cookies to set the offset
  field in struct dirent if we're using cookies to iterate
  through the dirents.
  
  Revision  ChangesPath
  1.43  +5 -2  src/sys/compat/linux/linux_file.c



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: FreeBSD Linux emulation / arla 0.34.6

2001-01-24 Thread Kris Kennaway

On Wed, Jan 24, 2001 at 12:50:29PM -0600, Chris wrote:
> Silly me--I forgot to mention, this is with FreeBSD 4.2-STABLE.

How recent -stable? A bug like this was fixed recently. If it's older
than a week, Try upgrading :-)

Kris

-- 
NOTE: To fetch an updated copy of my GPG key which has not expired,
finger [EMAIL PROTECTED]

 PGP signature


Re: FreeBSD Linux emulation / arla 0.34.6

2001-01-24 Thread Poul-Henning Kamp

In message <3A6F4748.15758.2090E6@localhost>, "Marco van de Voort" 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:
>
>Hmm. Could it be getdirentries itself, or some oddity that is not 
>documented, but worked around in libc? I also have some 
>getdirentries (FreeBSD version, patched together I directly admit) 
>based code that sometimes doesn't seem to be able to find certain 
>directories.

I had some fun with it when playing with a TOYFS of mine.

Take a peek in the libc sources, there are som assumptions which
may surprise you.

--
Poul-Henning Kamp   | UNIX since Zilog Zeus 3.20
[EMAIL PROTECTED] | TCP/IP since RFC 956
FreeBSD committer   | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: FreeBSD Linux emulation / arla 0.34.6

2001-01-24 Thread Marco van de Voort

> 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:

Hmm. Could it be getdirentries itself, or some oddity that is not 
documented, but worked around in libc? I also have some 
getdirentries (FreeBSD version, patched together I directly admit) 
based code that sometimes doesn't seem to be able to find certain 
directories.


Marco van de Voort ([EMAIL PROTECTED] or [EMAIL PROTECTED])




To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message



Re: FreeBSD Linux emulation / arla 0.34.6

2001-01-24 Thread Chris

Silly me--I forgot to mention, this is with FreeBSD 4.2-STABLE.

Chris


To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message