Linux NFS development
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Chuck Lever <chuck.lever@oracle.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH 14/27] NLM: Decode "priv" argument of NLMPROC_SM_NOTIFY as an opaque
Date: Wed, 10 Dec 2008 17:29:48 -0500	[thread overview]
Message-ID: <20081210222948.GL1212@fieldses.org> (raw)
In-Reply-To: <20081206000338.24075.50442.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>

On Fri, Dec 05, 2008 at 07:03:39PM -0500, Chuck Lever wrote:
> The NLM XDR decoders for the NLMPROC_SM_NOTIFY procedure should treat
> their "priv" argument truly as an opaque, as defined by the protocol,
> and let the upper layers figure out what is in it.
> 
> This will make it easier to modify the contents and interpretation of
> the "priv" argument, and keep knowledge about what's in "priv" local
> to fs/lockd/mon.c.
> 
> For now, the NLM and NSM implementations should behave exactly as they
> did before.
> 
> The formation of the address of the rebooted host in
> nlm_host_rebooted() may look a little strange, but it is the inverse
> of how nsm_init_private() forms the private cookie.  Plus, it's
> going away soon anyway.

OK, applied these four.

--b.

> 
> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
> ---
> 
>  fs/lockd/host.c           |    3 ++-
>  fs/lockd/xdr.c            |    4 ++--
>  fs/lockd/xdr4.c           |    4 ++--
>  include/linux/lockd/xdr.h |    8 ++++----
>  4 files changed, 10 insertions(+), 9 deletions(-)
> 
> diff --git a/fs/lockd/host.c b/fs/lockd/host.c
> index ed10338..dc41e46 100644
> --- a/fs/lockd/host.c
> +++ b/fs/lockd/host.c
> @@ -453,9 +453,10 @@ void nlm_release_host(struct nlm_host *host)
>   */
>  void nlm_host_rebooted(const struct nlm_reboot *info)
>  {
> +	__be32 *p = (__be32 *)&info->priv.data;
>  	const struct sockaddr_in sin = {
>  		.sin_family		= AF_INET,
> -		.sin_addr.s_addr	= info->addr,
> +		.sin_addr.s_addr	= *p,
>  	};
>  	struct hlist_head *chain;
>  	struct hlist_node *pos;
> diff --git a/fs/lockd/xdr.c b/fs/lockd/xdr.c
> index 1f22629..4cc7d01 100644
> --- a/fs/lockd/xdr.c
> +++ b/fs/lockd/xdr.c
> @@ -349,8 +349,8 @@ nlmsvc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp)
>  	if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
>  		return 0;
>  	argp->state = ntohl(*p++);
> -	/* Preserve the address in network byte order */
> -	argp->addr = *p++;
> +	memcpy(&argp->priv.data, p, sizeof(argp->priv.data));
> +	p += XDR_QUADLEN(SM_PRIV_SIZE);
>  	return xdr_argsize_check(rqstp, p);
>  }
>  
> diff --git a/fs/lockd/xdr4.c b/fs/lockd/xdr4.c
> index 50c493a..61d1714 100644
> --- a/fs/lockd/xdr4.c
> +++ b/fs/lockd/xdr4.c
> @@ -356,8 +356,8 @@ nlm4svc_decode_reboot(struct svc_rqst *rqstp, __be32 *p, struct nlm_reboot *argp
>  	if (!(p = xdr_decode_string_inplace(p, &argp->mon, &argp->len, SM_MAXSTRLEN)))
>  		return 0;
>  	argp->state = ntohl(*p++);
> -	/* Preserve the address in network byte order */
> -	argp->addr  = *p++;
> +	memcpy(&argp->priv.data, p, sizeof(argp->priv.data));
> +	p += XDR_QUADLEN(SM_PRIV_SIZE);
>  	return xdr_argsize_check(rqstp, p);
>  }
>  
> diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
> index 6b51992..6338866 100644
> --- a/include/linux/lockd/xdr.h
> +++ b/include/linux/lockd/xdr.h
> @@ -83,10 +83,10 @@ struct nlm_res {
>   * statd callback when client has rebooted
>   */
>  struct nlm_reboot {
> -	char *		mon;
> -	unsigned int	len;
> -	u32		state;
> -	__be32		addr;
> +	char			*mon;
> +	unsigned int		len;
> +	u32			state;
> +	struct nsm_private	priv;
>  };
>  
>  /*
> 

  parent reply	other threads:[~2008-12-10 22:29 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-06  0:01 [PATCH 00/27] Remaining IPv6 NSM patches for 2.6.29 Chuck Lever
     [not found] ` <20081205235557.24075.12511.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-06  0:01   ` [PATCH 01/27] NSM: Move NSM-related XDR data structures to lockd's xdr.h Chuck Lever
2008-12-06  0:02   ` [PATCH 02/27] NSM: Move NSM program and procedure numbers to fs/lockd/mon.c Chuck Lever
     [not found]     ` <20081206000206.24075.32502.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-10 20:09       ` J. Bruce Fields
2008-12-06  0:02   ` [PATCH 03/27] NSM: Add xdr_stream-based XDR encoders Chuck Lever
     [not found]     ` <20081206000214.24075.58074.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-10 20:35       ` J. Bruce Fields
2008-12-10 20:36         ` J. Bruce Fields
2008-12-10 20:54         ` Chuck Lever
2008-12-10 21:15           ` J. Bruce Fields
2008-12-06  0:02   ` [PATCH 04/27] " Chuck Lever
2008-12-06  0:02   ` [PATCH 05/27] NSM: Switch over to the new-style XDR functions Chuck Lever
2008-12-06  0:02   ` [PATCH 06/27] NSM: Remove unused old-style " Chuck Lever
2008-12-06  0:02   ` [PATCH 07/27] NSM: Move nsm_find() to fs/lockd/mon.c Chuck Lever
     [not found]     ` <20081206000244.24075.75258.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-10 20:58       ` J. Bruce Fields
2008-12-10 21:08         ` Chuck Lever
2008-12-06  0:02   ` [PATCH 08/27] NSM: Add dprintk() calls in nsm_find and nsm_release Chuck Lever
     [not found]     ` <20081206000252.24075.51827.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-10 21:05       ` J. Bruce Fields
2008-12-10 21:10         ` Chuck Lever
2008-12-10 21:14           ` J. Bruce Fields
2008-12-06  0:03   ` [PATCH 09/27] NSM: Remove NULL pointer check from nsm_find() Chuck Lever
2008-12-06  0:03   ` [PATCH 10/27] NSM: Remove !nsm check from nsm_release() Chuck Lever
     [not found]     ` <20081206000308.24075.73629.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-10 21:11       ` J. Bruce Fields
2008-12-06  0:03   ` [PATCH 11/27] NSM: Generate NSMPROC_MON's "priv" argument when nsm_handle is created Chuck Lever
2008-12-06  0:03   ` [PATCH 12/27] NSM: Encode the new "priv" cookie for NSMPROC_MON requests Chuck Lever
2008-12-06  0:03   ` [PATCH 13/27] NLM: Change nlm_host_rebooted() to take a single nlm_reboot argument Chuck Lever
2008-12-06  0:03   ` [PATCH 14/27] NLM: Decode "priv" argument of NLMPROC_SM_NOTIFY as an opaque Chuck Lever
     [not found]     ` <20081206000338.24075.50442.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-10 22:29       ` J. Bruce Fields [this message]
2008-12-06  0:03   ` [PATCH 15/27] NSM: Add nsm_lookup() function Chuck Lever
     [not found]     ` <20081206000346.24075.23426.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-10 22:58       ` J. Bruce Fields
2008-12-06  0:03   ` [PATCH 16/27] NLM: Call nsm_reboot_lookup() instead of nsm_find() Chuck Lever
2008-12-06  0:04   ` [PATCH 17/27] NLM: Remove "create" argument from nsm_find() Chuck Lever
     [not found]     ` <20081206000401.24075.77127.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-10 23:00       ` J. Bruce Fields
2008-12-06  0:04   ` [PATCH 18/27] NSM: Refactor nsm_handle creation into a helper function Chuck Lever
     [not found]     ` <20081206000409.24075.37859.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-10 23:28       ` J. Bruce Fields
2008-12-11 17:09         ` Chuck Lever
2008-12-11 18:53           ` J. Bruce Fields
2008-12-06  0:04   ` [PATCH 19/27] NSM: More clean up of nsm_get_handle() Chuck Lever
2008-12-06  0:04   ` [PATCH 20/27] NSM: Replace IP address as our nlm_reboot lookup key Chuck Lever
     [not found]     ` <20081206000424.24075.72384.stgit-07a7zB5ZJzbwdl/1UfZZQIVfYA8g3rJ/@public.gmane.org>
2008-12-10 23:43       ` J. Bruce Fields
2008-12-11 16:20         ` Chuck Lever
2008-12-06  0:04   ` [PATCH 21/27] NSM: Remove include/linux/lockd/sm_inter.h Chuck Lever
2008-12-06  0:04   ` [PATCH 22/27] NSM: Move nsm_addr() to fs/lockd/mon.c Chuck Lever
2008-12-06  0:04   ` [PATCH 23/27] NSM: Move nsm_use_hostnames to mon.c Chuck Lever
2008-12-06  0:04   ` [PATCH 24/27] NSM: Move nsm_create() Chuck Lever
2008-12-06  0:05   ` [PATCH 25/27] NLM: nlm_privileged_requester() doesn't recognize mapped loopback address Chuck Lever
2008-12-06  0:05   ` [PATCH 26/27] NLM: Rewrite IPv4 privileged requester's check Chuck Lever
2008-12-06  0:05   ` [PATCH 27/27] lockd: Enable NLM use of AF_INET6 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=20081210222948.GL1212@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=chuck.lever@oracle.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