Skip to contentSkip to conversation

ceph: increment i_version when doing a setattr with caps

PATCH In review Jeff Layton 2 participants 2 messages Aug 24, 2022 – Aug 25, 2022 Ceph client

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ceph: increment i_version when doing a setattr with caps

When the client has enough caps to satisfy a setattr locally without having to talk to the server, we currently do the setattr without incrementing the change attribute.

Ensure that if the ctime changes locally, then the change attribute does too.

---
 fs/ceph/inode.c | 1 +
 1 file changed, 1 insertion(+)
fs/ceph/inode.c +1 -0
index ccc926a7dcb0..65161296d449 100644
@@ -2192,6 +2192,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
 		inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied,
 							   &prealloc_cf);
 		inode->i_ctime = attr->ia_ctime;
+		inode_inc_iversion_raw(inode);
 	}
 
 	release &= issued;
Signature · 1 line
2.37.2
#1 lore raw
Quoted 17 lines · Jeff Layton

When the client has enough caps to satisfy a setattr locally without having to talk to the server, we currently do the setattr without incrementing the change attribute.

Ensure that if the ctime changes locally, then the change attribute does too.

---
  fs/ceph/inode.c | 1 +
  1 file changed, 1 insertion(+)
fs/ceph/inode.c +0 -0
index ccc926a7dcb0..65161296d449 100644

fs/ceph/inode.c int __ceph_setattr(struct inode *inode, struct iattr *attr) · line 2198

Quoted 7 lines
fs/ceph/inode.c +1 -0
@@ -2192,6 +2192,7 @@ int __ceph_setattr(struct inode *inode, struct iattr *attr)
  		inode_dirty_flags = __ceph_mark_dirty_caps(ci, dirtied,
  							   &prealloc_cf);
  		inode->i_ctime = attr->ia_ctime;
+		inode_inc_iversion_raw(inode);
  	}
 
  	release &= issued;

Good catch!

Merged into the testing branch.

Thanks!

-- Xiubo