All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Dickson <SteveD@redhat.com>
To: Neil Brown <neilb@suse.de>
Cc: chucklever@gmail.com, linux-nfs@vger.kernel.org
Subject: Re: [PATCH] sm-notify: perform DNS lookup in the background.
Date: Thu, 17 Jul 2008 06:29:47 -0400	[thread overview]
Message-ID: <487F1F1B.5080803@RedHat.com> (raw)
In-Reply-To: <18558.45412.19541.657376-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>



Neil Brown wrote:
> On Wednesday July 16, SteveD@redhat.com wrote:
>>> Arguably it would be cleaner architecturally if the DNS lookup were in
>>> notify_host().  Since doing it in notify() means you will be looking
>>> up these addresses on retries, maybe the host_lookup() call should be
>>> integrated into the "If we retransmitted 4 times" logic.  That would
>>> be an opportunity to fix the addrinfo leak in there.
> 
> What addrinfo leak is that?
See questions below...

> 
>>> [Note that freeaddrinfo(3) simply walks the list of addrinfo
>>> structures and frees them.  By setting ai_next to NULL in some of the
>>> addrinfo structures, sm-notify is orphaning them -- freeaddrinfo(3)
>>> will never find them].
>>>
> 
> I assume we are talking about the code in notify_host in the
>   if (host->retries >= 4) {
> branch.
> 
> What the code is doing is taking the first addrinfo from the host->ai
> list, and moving it to the end - effectively rotating the list.
> This shouldn't change what freeaddrinfo will do.
> 
> One of us is missing something.
>>
>> I believe the following patch address those minor comments... true?
> 
> Except for:
> 
>> @@ -349,7 +364,6 @@ notify_host(int sock, struct nsm_host *host)
>>  		while ( *next )
>>  			next = & (*next)->ai_next;
>>  		*next = hold;
>> -		hold->ai_next = NULL;
>>  		memcpy(&host->addr, hold->ai_addr, hold->ai_addrlen);
>>  		addr_set_port(&host->addr, 0);
>>  		host->retries = 0;
> 
> which I think is wrong, and wondering why:
After the while loop doesn't hold point to the head of the list?
If so, setting hold->ai_next = NULL; orphans the rest of the list, right?
Or am I missing something... 

steved.
  

  parent reply	other threads:[~2008-07-17 10:30 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-15  6:21 [PATCH] sm-notify: perform DNS lookup in the background Neil Brown
     [not found] ` <18556.16890.235207.711721-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2008-07-15 15:31   ` Chuck Lever
     [not found]     ` <76bd70e30807150831l294c7f0as8ba53709e71d5827-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2008-07-16 18:43       ` Steve Dickson
2008-07-17  2:41         ` Neil Brown
     [not found]           ` <18558.45412.19541.657376-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2008-07-17 10:29             ` Steve Dickson [this message]
2008-07-17 22:46               ` Neil Brown
2008-07-17 15:09             ` Chuck Lever
2008-07-17 22:59               ` Neil Brown
     [not found]                 ` <18559.52918.675492.673560-wvvUuzkyo1EYVZTmpyfIwg@public.gmane.org>
2008-07-18  4:41                   ` Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=487F1F1B.5080803@RedHat.com \
    --to=steved@redhat.com \
    --cc=chucklever@gmail.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=neilb@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.