Re: [PATCH] NLM: client-side nlm_lookup_host() should avoid matching on srcaddr

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

 



On Mon, Nov 24, 2008 at 12:51:55PM -0500, Chuck Lever wrote:
> Since commit c98451bd, the loop in nlm_lookup_host() unconditionally
> compares the host's h_srcaddr field to the incoming source address.
> For client-side nlm_host entries, both are always AF_UNSPEC, so this
> check is unnecessary.
> 
> Since commit 781b61a6, which added support for AF_INET6 addresses to
> nlm_cmp_addr(), nlm_cmp_addr() now returns FALSE for AF_UNSPEC
> addresses, which causes nlm_lookup_host() to create a fresh nlm_host
> entry every time it is called on the client.
> 
> These extra entries will eventually expire once the server is
> unmounted, so the impact of this regression, introduced with lockd
> IPv6 support in 2.6.28, should be minor.
> 
> We could fix this by adding an arm in nlm_cmp_addr() for AF_UNSPEC
> addresses, but really, nlm_lookup_host() shouldn't be matching on the
> srcaddr field for client-side nlm_host lookups.

Applied, thanks.

(Possible future improvement: names like memcmp() have left me
terminally confused about what the return value from a function like
nlm_cmp_addr() is likely to mean--I always have to check the
implementation.  A name like nlm_same_addr() would make them
unambiguous.)

--b.

> 
> Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
> ---
> 
>  fs/lockd/host.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/lockd/host.c b/fs/lockd/host.c
> index 9fd8889..70fc63a 100644
> --- a/fs/lockd/host.c
> +++ b/fs/lockd/host.c
> @@ -167,7 +167,8 @@ static struct nlm_host *nlm_lookup_host(struct nlm_lookup_host_info *ni)
>  			continue;
>  		if (host->h_server != ni->server)
>  			continue;
> -		if (!nlm_cmp_addr(nlm_srcaddr(host), ni->src_sap))
> +		if (ni->server &&
> +		    !nlm_cmp_addr(nlm_srcaddr(host), ni->src_sap))
>  			continue;
>  
>  		/* Move to head of hash chain. */
> 
> --
> 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
--
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