ceph: prevent i_version from going back
authorYan, Zheng <zyan@redhat.com>
Sat, 26 May 2018 08:54:39 +0000 (16:54 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Mon, 4 Jun 2018 18:46:01 +0000 (20:46 +0200)
inode info from non-auth can be stale.

Signed-off-by: "Yan, Zheng" <zyan@redhat.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
fs/ceph/inode.c

index 4aeccb1..4fda7a9 100644 (file)
@@ -889,7 +889,8 @@ static int fill_inode(struct inode *inode, struct page *locked_page,
        }
 
        /* 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;