All of lore.kernel.org
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@redhat.com>
To: Olga Kornievskaia <kolga@netapp.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [RFC v1 01/18] NFSD add ca_source_server<> to COPY
Date: Fri, 1 Sep 2017 15:52:29 -0400	[thread overview]
Message-ID: <20170901195229.GC27922@parsley.fieldses.org> (raw)
In-Reply-To: <20170302160142.30413-2-kolga@netapp.com>

On Thu, Mar 02, 2017 at 11:01:25AM -0500, Olga Kornievskaia wrote:
> From: Andy Adamson <andros@netapp.com>
> 
> Note: followed conventions and have struct nfsd4_compoundargs pointer as a
> parameter even though it is unused.

I'd understand if nfsd4_decode_nl4_server was an op decoder, but it
looks like it's called by some other decoder?  In which case, there's no
need for the unused argument.

I can't find the definition for struct nl4_server anyway, was this
supposed to apply on top of another set of patches?

So if you send a COPY request with a source server list to the current
(unpatched) server, it looks like you just get back BADXDR?  That sounds
like a bug in the current server.  But I suppose the client may be stuck
with that behavior.  How does the client handle that error from COPY?

--b.

> 
> Signed-off-by: Andy Adamson <andros@netapp.com>
> ---
>  fs/nfsd/nfs4xdr.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++--
>  fs/nfsd/xdr4.h    |  4 +++
>  2 files changed, 77 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
> index 382c1fd..f62cbad 100644
> --- a/fs/nfsd/nfs4xdr.c
> +++ b/fs/nfsd/nfs4xdr.c
> @@ -41,6 +41,7 @@
>  #include <linux/utsname.h>
>  #include <linux/pagemap.h>
>  #include <linux/sunrpc/svcauth_gss.h>
> +#include <linux/sunrpc/addr.h>
>  
>  #include "idmap.h"
>  #include "acl.h"
> @@ -1726,11 +1727,58 @@ static __be32 nfsd4_decode_reclaim_complete(struct nfsd4_compoundargs *argp, str
>  	DECODE_TAIL;
>  }
>  
> +static __be32 nfsd4_decode_nl4_server(struct nfsd4_compoundargs *argp,
> +				      struct nl4_server *ns)
> +{
> +	DECODE_HEAD;
> +	struct nfs42_netaddr *naddr;
> +
> +	READ_BUF(4);
> +	ns->nl4_type = be32_to_cpup(p++);
> +
> +	/* currently support for 1 inter-server source server */
> +	switch (ns->nl4_type) {
> +	case NL4_NAME:
> +	case NL4_URL:
> +		READ_BUF(4);
> +		ns->u.nl4_str_sz = be32_to_cpup(p++);
> +		if (ns->u.nl4_str_sz > NFS4_OPAQUE_LIMIT)
> +			goto xdr_error;
> +
> +		READ_BUF(ns->u.nl4_str_sz);
> +		COPYMEM(ns->u.nl4_str,
> +			ns->u.nl4_str_sz);
> +		break;
> +	case NL4_NETADDR:
> +		naddr = &ns->u.nl4_addr;
> +
> +		READ_BUF(4);
> +		naddr->na_netid_len = be32_to_cpup(p++);
> +		if (naddr->na_netid_len > RPCBIND_MAXNETIDLEN)
> +			goto xdr_error;
> +
> +		READ_BUF(naddr->na_netid_len + 4); /* 4 for uaddr len */
> +		COPYMEM(naddr->na_netid, naddr->na_netid_len);
> +
> +		naddr->na_uaddr_len = be32_to_cpup(p++);
> +		if (naddr->na_uaddr_len > RPCBIND_MAXUADDRLEN)
> +			goto xdr_error;
> +
> +		READ_BUF(naddr->na_uaddr_len);
> +		COPYMEM(naddr->na_uaddr, naddr->na_uaddr_len);
> +		break;
> +	default:
> +		goto xdr_error;
> +	}
> +	DECODE_TAIL;
> +}
> +
>  static __be32
>  nfsd4_decode_copy(struct nfsd4_compoundargs *argp, struct nfsd4_copy *copy)
>  {
>  	DECODE_HEAD;
> -	unsigned int tmp;
> +	struct nl4_server *ns;
> +	int i;
>  
>  	status = nfsd4_decode_stateid(argp, &copy->cp_src_stateid);
>  	if (status)
> @@ -1745,8 +1793,29 @@ static __be32 nfsd4_decode_reclaim_complete(struct nfsd4_compoundargs *argp, str
>  	p = xdr_decode_hyper(p, &copy->cp_count);
>  	copy->cp_consecutive = be32_to_cpup(p++);
>  	copy->cp_synchronous = be32_to_cpup(p++);
> -	tmp = be32_to_cpup(p); /* Source server list not supported */
> +	copy->cp_src.nl_nsvr = be32_to_cpup(p++);
>  
> +	if (copy->cp_src.nl_nsvr == 0) /* intra-server copy */
> +		goto intra;
> +
> +	/** Support NFSD4_MAX_SSC_SRC number of source servers.
> +	 * freed in nfsd4_encode_copy
> +	 */
> +	if (copy->cp_src.nl_nsvr > NFSD4_MAX_SSC_SRC)
> +		copy->cp_src.nl_nsvr = NFSD4_MAX_SSC_SRC;
> +	copy->cp_src.nl_svr = kmalloc(copy->cp_src.nl_nsvr *
> +					sizeof(struct nl4_server), GFP_KERNEL);
> +	if (copy->cp_src.nl_svr == NULL)
> +		return nfserrno(-ENOMEM);
> +
> +	ns = copy->cp_src.nl_svr;
> +	for (i = 0; i < copy->cp_src.nl_nsvr; i++) {
> +		status = nfsd4_decode_nl4_server(argp, ns);
> +		if (status)
> +			return status;
> +		ns++;
> +	}
> +intra:
>  	DECODE_TAIL;
>  }
>  
> @@ -4295,6 +4364,8 @@ static __be32 nfsd4_encode_readv(struct nfsd4_compoundres *resp,
>  		*p++ = cpu_to_be32(copy->cp_consecutive);
>  		*p++ = cpu_to_be32(copy->cp_synchronous);
>  	}
> +	/* allocated in nfsd4_decode_copy */
> +	kfree(copy->cp_src.nl_svr);
>  	return nfserr;
>  }
>  
> diff --git a/fs/nfsd/xdr4.h b/fs/nfsd/xdr4.h
> index 8fda4ab..6b1a61fc 100644
> --- a/fs/nfsd/xdr4.h
> +++ b/fs/nfsd/xdr4.h
> @@ -509,6 +509,9 @@ struct nfsd42_write_res {
>  	nfs4_verifier		wr_verifier;
>  };
>  
> +/*  support 1 source server for now */
> +#define NFSD4_MAX_SSC_SRC       1
> +
>  struct nfsd4_copy {
>  	/* request */
>  	stateid_t	cp_src_stateid;
> @@ -516,6 +519,7 @@ struct nfsd4_copy {
>  	u64		cp_src_pos;
>  	u64		cp_dst_pos;
>  	u64		cp_count;
> +	struct nl4_servers cp_src;
>  
>  	/* both */
>  	bool		cp_consecutive;
> -- 
> 1.8.3.1
> 

  reply	other threads:[~2017-09-01 19:52 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02 16:01 [RFC v1 00/17] NFSD support for inter+async COPY Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 01/18] NFSD add ca_source_server<> to COPY Olga Kornievskaia
2017-09-01 19:52   ` J. Bruce Fields [this message]
2017-09-01 20:14     ` Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 02/18] NFSD add COPY_NOTIFY operation Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 03/18] NFSD generalize nfsd4_compound_state flag names Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 04/18] NFSD: allow inter server COPY to have a STALE source server fh Olga Kornievskaia
2017-09-01 20:23   ` J. Bruce Fields
2017-09-01 20:25     ` Olga Kornievskaia
2017-09-01 21:16       ` J. Bruce Fields
2017-09-01 21:24         ` J. Bruce Fields
2017-03-02 16:01 ` [RFC v1 05/18] NFSD add nfs4 inter ssc to nfsd4_copy Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 06/18] NFSD return nfs4_stid in nfs4_preprocess_stateid_op Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 07/18] NFSD Unique stateid_t for inter server to server COPY authentication Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 08/18] NFSD CB_OFFLOAD xdr Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 09/18] NFSD OFFLOAD_STATUS xdr Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 10/18] NFSD OFFLOAD_CANCEL xdr Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 11/18] NFSD xdr callback stateid in async COPY reply Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 12/18] NFSD first draft of async copy Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 13/18] NFSD handle OFFLOAD_CANCEL op Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 14/18] NFSD stop queued async copies on client shutdown Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 15/18] NFSD create new stateid for async copy Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 16/18] NFSD define EBADF in nfserrno Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 17/18] NFSD support OFFLOAD_STATUS Olga Kornievskaia
2017-03-02 16:01 ` [RFC v1 18/18] NFSD remove copy stateid when vfs_copy_file_range completes Olga Kornievskaia
2017-03-17 21:21 ` [RFC v1 00/17] NFSD support for inter+async COPY Olga Kornievskaia
2017-03-20 15:30   ` J. Bruce Fields
2017-03-27 21:49     ` Olga Kornievskaia
2017-09-01 19:41 ` J. Bruce Fields
2017-09-01 19:42   ` J. Bruce Fields
2017-09-01 19:48   ` Olga Kornievskaia
2017-09-01 19:53     ` J. Bruce Fields
2017-09-01 20:02       ` Olga Kornievskaia
2017-09-01 20:09         ` J. Bruce Fields
2017-09-01 20:34           ` Olga Kornievskaia
2017-09-01 21:19             ` J. Bruce Fields

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=20170901195229.GC27922@parsley.fieldses.org \
    --to=bfields@redhat.com \
    --cc=kolga@netapp.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 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.