Blob Blame History Raw
From 1f15a550f5f3e328b7693f664ae21f5a71a7a636 Mon Sep 17 00:00:00 2001
From: Jeff Layton <jlayton@redhat.com>
Date: Mon, 11 Dec 2017 06:35:16 -0500
Subject: [PATCH 14/24] nfsd: convert to new i_version API
Git-commit: 1f15a550f5f3e328b7693f664ae21f5a71a7a636
Patch-mainline: v4.16-rc1
References: bsc#1081186

Mostly just making sure we use the "get" wrappers so we know when
it is being fetched for later use.

Signed-off-by: Jeff Layton <jlayton@redhat.com>
Acked-by: Jan Kara <jack@suse.cz>

---
 fs/nfsd/nfs3xdr.c |    3 ++-
 fs/nfsd/nfs4xdr.c |    3 ++-
 fs/nfsd/nfsfh.h   |    3 ++-
 3 files changed, 6 insertions(+), 3 deletions(-)

--- a/fs/nfsd/nfs3xdr.c
+++ b/fs/nfsd/nfs3xdr.c
@@ -8,6 +8,7 @@
 
 #include <linux/namei.h>
 #include <linux/sunrpc/svc_xprt.h>
+#include <linux/iversion.h>
 #include "xdr3.h"
 #include "auth.h"
 #include "netns.h"
@@ -260,7 +261,7 @@ void fill_post_wcc(struct svc_fh *fhp)
 		printk("nfsd: inode locked twice during operation.\n");
 
 	err = fh_getattr(fhp, &fhp->fh_post_attr);
-	fhp->fh_post_change = d_inode(fhp->fh_dentry)->i_version;
+	fhp->fh_post_change = inode_query_iversion(d_inode(fhp->fh_dentry));
 	if (err) {
 		fhp->fh_post_saved = false;
 		/* Grab the ctime anyway - set_change_info might use it */
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -40,6 +40,7 @@
 #include <linux/statfs.h>
 #include <linux/utsname.h>
 #include <linux/pagemap.h>
+#include <linux/iversion.h>
 #include <linux/sunrpc/svcauth_gss.h>
 
 #include "idmap.h"
@@ -1971,7 +1972,7 @@ static __be32 *encode_change(__be32 *p,
 		*p++ = cpu_to_be32(convert_to_wallclock(exp->cd->flush_time));
 		*p++ = 0;
 	} else if (IS_I_VERSION(inode)) {
-		p = xdr_encode_hyper(p, inode->i_version);
+		p = xdr_encode_hyper(p, inode_query_iversion(inode));
 	} else {
 		*p++ = cpu_to_be32(stat->ctime.tv_sec);
 		*p++ = cpu_to_be32(stat->ctime.tv_nsec);
--- a/fs/nfsd/nfsfh.h
+++ b/fs/nfsd/nfsfh.h
@@ -10,6 +10,7 @@
 #include <linux/crc32.h>
 #include <linux/sunrpc/svc.h>
 #include <uapi/linux/nfsd/nfsfh.h>
+#include <linux/iversion.h>
 
 static inline __u32 ino_t_to_u32(ino_t ino)
 {
@@ -253,7 +254,7 @@ fill_pre_wcc(struct svc_fh *fhp)
 		fhp->fh_pre_mtime = inode->i_mtime;
 		fhp->fh_pre_ctime = inode->i_ctime;
 		fhp->fh_pre_size  = inode->i_size;
-		fhp->fh_pre_change = inode->i_version;
+		fhp->fh_pre_change = inode_query_iversion(inode);
 		fhp->fh_pre_saved = true;
 	}
 }