From: Xiubo Li Date: Mon, 11 Apr 2022 02:34:16 +0000 (+0800) Subject: client: skip sync statx when only AT_STATX_DONT_SYNC flag is set X-Git-Tag: v16.2.11~477^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F46679%2Fhead;p=ceph.git client: skip sync statx when only AT_STATX_DONT_SYNC flag is set 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. Fixes: https://tracker.ceph.com/issues/55253 Signed-off-by: Xiubo Li (cherry picked from commit 2184c3247e546b4f67bee0774e2c97ec2d35a2f3) --- diff --git a/src/client/Client.cc b/src/client/Client.cc index 3513de3518b3..949bb69b3c27 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -7903,8 +7903,8 @@ unsigned Client::statx_to_mask(unsigned int flags, unsigned int want) { unsigned mask = 0; - /* if AT_STATX_DONT_SYNC is set, then we don't need any -- just use what's in cache */ - if (flags & AT_STATX_DONT_SYNC) + /* The AT_STATX_FORCE_SYNC is always in higher priority than AT_STATX_DONT_SYNC. */ + if ((flags & AT_STATX_SYNC_TYPE) == AT_STATX_DONT_SYNC) goto out; /* Always set PIN to distinguish from AT_STATX_DONT_SYNC case */