Re: [PATCH] sm-notify: perform DNS lookup in the background.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thursday July 17, SteveD@xxxxxxxxxx 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
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux