This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: NIS performance patches


On Thu, Jan 15, Thorsten Kukuk wrote:

> > > 2) If /var/yp/binding has bad data in it (e.g., a server that went
> > >    offline), then calls do_ypcall() will fail w/o trying to find
> > >    a new NIS server.  So, two lines of code are added to do_ypcall()
> > >    that, in the event of an error from clnt_call(), try calling
> > >    __yp_bind_ypbindprog() (one of our new functions), which in turn
> > >    does
> > >      clnt_call (client, YPBINDPROC_DOMAIN, ...)
> > >    which in turn calls ypbindproc_domain() in the ypbind daemon
> > >    which calls test_bindings_once() and hopefully finds a new
> > >    server.
> 
> And this part is not ok. While the idea is correct, the implementation
> does the worst thing that could happen (in conjunction with your
> ypbind changes):

Even more worse: this part creates a file handle leak and a memory
leak. You cannot overwrite a clnt_handle without giving it free
before.

Attached is a rewritten version of your patch. The first part is
identical, except that I reformated the source code.

The second part is a rewrite of do_ypcall. It is a unroll of the
loop, to make the code simpler and easier to understand.
If the cached data and the data from the binding direcotory don't
work, I have added a third step, which asks ypbind.
This is only necessary, if USE_BINDINGDIR is defined. Else, the
second step will already call ypbind.

Please test this patch. It does compile, everything else is untested.

  Thorsten

-- 
Thorsten Kukuk       http://www.suse.de/~kukuk/        kukuk@suse.de
SuSE Linux AG        Maxfeldstr. 5                 D-90409 Nuernberg
--------------------------------------------------------------------    
Key fingerprint = A368 676B 5E1B 3E46 CFCE  2D97 F8FD 4E23 56C6 FB4B


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]