Skip to contentSkip to conversation

ceph: fix statx AT_STATX_DONT_SYNC vs AT_STATX_FORCE_SYNC check

RFC PATCH In review [email protected] 2 participants 3 messages Apr 11, 2022 Ceph client

lore
Share & tools
lore
#0 lore raw

RFC PATCH 1/1 ceph: fix statx AT_STATX_DONT_SYNC vs AT_STATX_FORCE_SYNC check

From: Xiubo Li <[email protected]>

From the posix and the initial statx supporting commit comments, the AT_STATX_DONT_SYNC is a lightweight stat flag and the AT_STATX_FORCE_SYNC is a heaverweight one. And also checked all the other current usage about these two flags they are all doing the same, that is only when the AT_STATX_FORCE_SYNC is not set and the AT_STATX_DONT_SYNC is set will they skip sync retriving the attributes from storage.

---
 fs/ceph/inode.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/ceph/inode.c +1 -1
index 6788a1f88eb6..1ee6685def83 100644
@@ -2887,7 +2887,7 @@ int ceph_getattr(struct user_namespace *mnt_userns, const struct path *path,
 		return -ESTALE;
 
 	/* Skip the getattr altogether if we're asked not to sync */
-	if (!(flags & AT_STATX_DONT_SYNC)) {
+	if ((flags & AT_STATX_SYNC_TYPE) != AT_STATX_DONT_SYNC) {
 		err = ceph_do_getattr(inode,
 				statx_to_caps(request_mask, inode->i_mode),
 				flags & AT_STATX_FORCE_SYNC);
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 3 lines · [email protected] wrote:

From the posix and the initial statx supporting commit comments, the AT_STATX_DONT_SYNC is a lightweight stat flag and the AT_STATX_FORCE_SYNC is a heaverweight one.

They're not flags. It's an enumeration overlain on the at_flags parameter because syscalls have a limited number of parameters.

Quoted 7 lines

And also checked all
the other current usage about these two flags they are all doing the same, that is only when the AT_STATX_FORCE_SYNC is not set and the AT_STATX_DONT_SYNC is set will they skip sync retriving the attributes from storage.

author
#2 lore raw
Quoted 7 lines · David Howells
Quoted 3 lines · [email protected] wrote:

From the posix and the initial statx supporting commit comments,
the AT_STATX_DONT_SYNC is a lightweight stat flag and the AT_STATX_FORCE_SYNC is a heaverweight one.

They're not flags. It's an enumeration overlain on the at_flags parameter because syscalls have a limited number of parameters.

Okay, will fix this.

Quoted 8 lines
Quoted 7 lines

And also checked all
the other current usage about these two flags they are all doing the same, that is only when the AT_STATX_FORCE_SYNC is not set and the AT_STATX_DONT_SYNC is set will they skip sync retriving the attributes from storage.

Thanks David.

-- Xiubo

Quoted 1 line