[pnfs] [PATCH 1/1] pnfsd: layoutcommit set size fix

Ricardo Labiaga ricardo.labiaga at netapp.com
Tue Mar 4 19:01:44 EST 2008


From: Ricardo Labiaga <Ricardo.Labiaga at netapp.com>

nfsd4_layoutcommit() should only reset the size of the file if
the client modified the file size.  The client indicates size change
by setting the no_newoffset field in the LAYOUT_COMMIT message.

Note that the 'no_' prefix stands for "new offset", not for negative.
If no_newoffset is false while XDR decoding (no file change), we set
lcp->lc_newoffset to zero to indicate this.

Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga at netapp.com>
---
 fs/nfsd/nfs4proc.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/fs/nfsd/nfs4proc.c b/fs/nfsd/nfs4proc.c
index be017b2..5839c57 100644
--- a/fs/nfsd/nfs4proc.c
+++ b/fs/nfsd/nfs4proc.c
@@ -1098,7 +1098,8 @@ nfsd4_layoutcommit(struct svc_rqst *rqstp,
 		__FUNCTION__, lcp->lc_last_wr + 1, ino->i_size);
 
 	fh_lock(current_fh);
-	if ((lcp->lc_last_wr + 1) <= ino->i_size) {
+	if ((lcp->lc_newoffset == 0) ||
+	    ((lcp->lc_last_wr + 1) <= ino->i_size)) {
 		status = 0;
 		lcp->lc_size_chg = 0;
 		fh_unlock(current_fh);
-- 
1.5.3.3



More information about the pNFS mailing list