Blob Blame History Raw
From: "Yan, Zheng" <zyan@redhat.com>
Date: Sat, 26 May 2018 16:54:39 +0800
Subject: ceph: prevent i_version from going back
Git-commit: aae1a442f8eac6d5442ee479df66d278c73a6ecc
Patch-mainline: v4.18-rc1
References: bsc#1098236

inode info from non-auth can be stale.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
Acked-by: Luis Henriques <lhenriques@suse.com>
---
 fs/ceph/inode.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -869,7 +869,8 @@ static int fill_inode(struct inode *inod
 	}
 
 	/* finally update i_version */
-	ci->i_version = le64_to_cpu(info->version);
+	if (le64_to_cpu(info->version) > ci->i_version)
+		ci->i_version = le64_to_cpu(info->version);
 
 	inode->i_mapping->a_ops = &ceph_aops;