From: Trond Myklebust <trondmy@gmail.com>
Date: Mon, 6 Jan 2020 20:25:13 +0000 (-0500)
Subject: NFS: When resending after a short write, reset the reply count to zero
X-Git-Tag: v5.6-rc1~29^2~28
X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=8c9cb71491e7fd3ebee90d9799c9ca5b769bd0f4;p=users%2Fjedix%2Flinux-maple.git

NFS: When resending after a short write, reset the reply count to zero

If we're resending a write due to a short read or write, ensure we
reset the reply count to zero.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
---

diff --git a/fs/nfs/read.c b/fs/nfs/read.c
index 12deb3bdb2a0..34bb9add2302 100644
--- a/fs/nfs/read.c
+++ b/fs/nfs/read.c
@@ -281,6 +281,8 @@ static void nfs_readpage_retry(struct rpc_task *task,
 	argp->offset += resp->count;
 	argp->pgbase += resp->count;
 	argp->count -= resp->count;
+	resp->count = 0;
+	resp->eof = 0;
 	rpc_restart_call_prepare(task);
 }
 
diff --git a/fs/nfs/write.c b/fs/nfs/write.c
index 83f92a4d65dc..c478b772cc49 100644
--- a/fs/nfs/write.c
+++ b/fs/nfs/write.c
@@ -1658,6 +1658,8 @@ static void nfs_writeback_result(struct rpc_task *task,
 			 */
 			argp->stable = NFS_FILE_SYNC;
 		}
+		resp->count = 0;
+		resp->verf->committed = 0;
 		rpc_restart_call_prepare(task);
 	}
 }