All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olga Kornievskaia <kolga@netapp.com>
To: <Trond.Myklebust@primarydata.com>, <anna.schumaker@netapp.com>
Cc: <linux-nfs@vger.kernel.org>
Subject: [PATCH v6 06/12] NFS COPY xdr handle async reply
Date: Tue, 24 Oct 2017 13:47:19 -0400	[thread overview]
Message-ID: <20171024174725.74870-7-kolga@netapp.com> (raw)
In-Reply-To: <20171024174725.74870-1-kolga@netapp.com>

If server returns async reply, it must include a callback stateid,
wr_callback_id in the write_response4.

Signed-off-by: Olga Kornievskaia <kolga@netapp.com>
---
 fs/nfs/nfs42xdr.c       | 22 ++++++++++++----------
 include/linux/nfs_xdr.h |  1 +
 2 files changed, 13 insertions(+), 10 deletions(-)

diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c
index e66dd1c..cb62c0c 100644
--- a/fs/nfs/nfs42xdr.c
+++ b/fs/nfs/nfs42xdr.c
@@ -426,21 +426,23 @@ static int decode_write_response(struct xdr_stream *xdr,
 				 struct nfs42_write_res *res)
 {
 	__be32 *p;
+	int status, count;
 
-	p = xdr_inline_decode(xdr, 4 + 8 + 4);
+	p = xdr_inline_decode(xdr, 4);
 	if (unlikely(!p))
 		goto out_overflow;
-
-	/*
-	 * We never use asynchronous mode, so warn if a server returns
-	 * a stateid.
-	 */
-	if (unlikely(*p != 0)) {
-		pr_err_once("%s: server has set unrequested "
-				"asynchronous mode\n", __func__);
+	count = be32_to_cpup(p);
+	if (count > 1)
 		return -EREMOTEIO;
+	else if (count == 1) {
+		status = decode_opaque_fixed(xdr, &res->stateid,
+				NFS4_STATEID_SIZE);
+		if (unlikely(status))
+			goto out_overflow;
 	}
-	p++;
+	p = xdr_inline_decode(xdr, 8 + 4);
+	if (unlikely(!p))
+		goto out_overflow;
 	p = xdr_decode_hyper(p, &res->count);
 	res->verifier.committed = be32_to_cpup(p);
 	return decode_verifier(xdr, &res->verifier.verifier);
diff --git a/include/linux/nfs_xdr.h b/include/linux/nfs_xdr.h
index 5ffd745..784ec8d 100644
--- a/include/linux/nfs_xdr.h
+++ b/include/linux/nfs_xdr.h
@@ -1387,6 +1387,7 @@ struct nfs42_copy_args {
 };
 
 struct nfs42_write_res {
+	nfs4_stateid		stateid;
 	u64			count;
 	struct nfs_writeverf	verifier;
 };
-- 
1.8.3.1


  parent reply	other threads:[~2017-10-24 17:47 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24 17:47 [PATCH v6 00/12] NFS support for async intra COPY Olga Kornievskaia
2017-10-24 17:47 ` [PATCH v6 01/12] fs: Don't copy beyond the end of the file Olga Kornievskaia
2017-10-24 17:47 ` [PATCH v6 02/12] NFS CB_OFFLOAD xdr Olga Kornievskaia
2017-10-24 17:47 ` [PATCH v6 03/12] NFS OFFLOAD_STATUS xdr Olga Kornievskaia
2017-10-24 17:47 ` [PATCH v6 04/12] NFS OFFLOAD_STATUS op Olga Kornievskaia
2017-10-24 17:47 ` [PATCH v6 05/12] NFS OFFLOAD_CANCEL xdr Olga Kornievskaia
2017-10-24 17:47 ` Olga Kornievskaia [this message]
2017-10-24 17:47 ` [PATCH v6 07/12] NFS add support for asynchronous COPY Olga Kornievskaia
2017-10-26 17:53   ` Anna Schumaker
2017-10-26 19:15     ` Olga Kornievskaia
2017-10-24 17:47 ` [PATCH v6 08/12] NFS handle COPY reply CB_OFFLOAD call race Olga Kornievskaia
2017-10-24 17:47 ` [PATCH v6 09/12] NFS export nfs4_async_handle_error Olga Kornievskaia
2017-10-24 17:47 ` [PATCH v6 10/12] NFS send OFFLOAD_CANCEL when COPY killed Olga Kornievskaia
2017-10-24 17:47 ` [PATCH v6 11/12] NFS handle COPY ERR_OFFLOAD_NO_REQS Olga Kornievskaia
2017-10-24 17:47 ` [PATCH v6 12/12] NFS add a simple sync nfs4_proc_commit after async COPY Olga Kornievskaia

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=20171024174725.74870-7-kolga@netapp.com \
    --to=kolga@netapp.com \
    --cc=Trond.Myklebust@primarydata.com \
    --cc=anna.schumaker@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.