Linux NFS development
 help / color / mirror / Atom feed
From: Neil Brown <neilb@suse.de>
To: Steve Dickson <SteveD@redhat.com>
Cc: chucklever@gmail.com, linux-nfs@vger.kernel.org
Subject: Re: [PATCH] sm-notify: perform DNS lookup in the background.
Date: Fri, 18 Jul 2008 08:46:55 +1000	[thread overview]
Message-ID: <18559.52191.42583.685790@notabene.brown> (raw)
In-Reply-To: message from Steve Dickson on Thursday July 17

On Thursday July 17, SteveD@redhat.com wrote:
> > 
> >> @@ -349,7 +364,6 @@ notify_host(int sock, struct nsm_host *host)
		struct addrinfo *hold = host->ai;
		struct addrinfo **next = &host->ai;
		*next = hold->ai_next;
> >>  		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.
>   

After the while loop, hold points to the original head of the list.
However the new head of this list was put in place by
        *next = hold->ai_next;

as next == &host->ai, the above line is equivalent to

        host->ai = host->ai->ai_next;

which clearly move the head pointer to the second entry.
hold->ai_next also points to this new head, so we have to clear it
(hold->ai = NULL) when we attach it to the end of the list
(*next = hold;, after the while loop).

NeilBrown

  reply	other threads:[~2008-07-17 22:46 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
2008-07-17 22:46               ` Neil Brown [this message]
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=18559.52191.42583.685790@notabene.brown \
    --to=neilb@suse.de \
    --cc=SteveD@redhat.com \
    --cc=chucklever@gmail.com \
    --cc=linux-nfs@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox