Re: More on Bad Bug

2001-04-17 Thread Alfred Perlstein

* Terry Lambert <[EMAIL PROTECTED]> [010417 16:28] wrote:
> 
> I guess no one else is interested in this bug hunt, or no one else
> is using 30,000 sockets on any of their machines?

I've committed a variation of your invariants check to -current,
-stable is frozen and I'd prefer to leave it as is until after
the release date.

As far as tracking down the problem I don't have the resources in
terms of hardware, code and time for that right now, however it
looks like you've found a possible bug.

Please keep us in the loop on this.

-- 
-Alfred Perlstein - [[EMAIL PROTECTED]|[EMAIL PROTECTED]]
http://www.egr.unlv.edu/~slumos/on-netbsd.html

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



Re: More on Bad Bug

2001-04-17 Thread Matt Dillon


:There seems to be some bad code in soo_close(), which looks like:
:
:   int
:   soo_close(fp, p)
:   struct file *fp;
:   struct proc *p;   
:   {
:   int error = 0;
:
:   fp->f_ops = &badfileops;
:   if (fp->f_data)
:   error = soclose((struct socket *)fp->f_data);
:   fp->f_data = 0; 
:   return (error);
:   }
:
:It seems to me this should be?
:
:   int
:   soo_close(fp, p)
:   struct file *fp;
:   struct proc *p;   
:   {
:   int error = 0;
:
:   if (fp->f_data)
:   error = soclose((struct socket *)fp->f_data);
:   if (!error) {
:   fp->f_data = 0; 
:   fp->f_ops = &badfileops;
:   }
:   return (error);
:   }
:...
:But it's not clear that this is correct for the socket code.

I think this is ok.  soclose() is passed a socket structure which
has no concept of the original struct file that held it.

:Credentials are actually used _AMAZINGLY_ much; it seems that they
:are a good candidate for some optimization to throw away references
:that aren't really necessary (for example, it seems to me that a
:socket can not exist without an fdp referencing it, and the fdp has
:a reference count on the cred which the socket inherits from the fdp,
:so the fdp's reference protects the sockets reference, and so the
:socket's reference doesn't really need to be reference counted).

There should be a reference count for each reference.  The credential
is stored in the socket structure so it is the responsibility of the 
socket code to gain another reference to it when it makes the assignment.

I wouldn't worry about trying to optimize ref count cases... you are
talking about nanoseconds there.

:In any case, I'm leaving in the panic patch I sent earlier, and am
:now rebuilding with my ucred reference count moved past the area

I think the panic patch is an excellent idea and should be comitted
and (after we unfreeze) MFC'd.  Moving the ref count to catch
double-frees is a good idea as well.

:I guess no one else is interested in this bug hunt, or no one else
:is using 30,000 sockets on any of their machines?
:
:   Terry Lambert
:   [EMAIL PROTECTED]

I'm still interested!

-Matt


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