[PATCH v2 5/5] ceph: keep LAZYIO with the read caps of a closed file
From: Xiubo Li via B4 Relay
Date: Wed Oct 21 2026 - 07:59:21 EST
From: Xiubo Li <xiubo.li@xxxxxxxxx>
A lazy I/O open of a file in LOCK_SYNC gets LAZYIO issued along with
the read caps. Once the file is closed and its wanted caps lapse,
ceph_check_caps() keeps the shared and read caps of a file that was
not opened for writing, but not LAZYIO, so it sends the MDS a cap
update for every closed file only to give LAZYIO back. With the
lazyio mount option, io500 mdtest-hard-read sends about one such
message per file read, from about 60 seconds after the reads start,
and the MDS serves the reads more slowly while they arrive.
Keep LAZYIO under the same condition as the read caps. The MDS still
revokes it together with CACHE when another client needs the file.
Signed-off-by: Xiubo Li <xiubo.li@xxxxxxxxx>
---
fs/ceph/caps.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/ceph/caps.c b/fs/ceph/caps.c
index 49e5c1c36b68..aca09351a094 100644
--- a/fs/ceph/caps.c
+++ b/fs/ceph/caps.c
@@ -2266,10 +2266,13 @@ void ceph_check_caps(struct ceph_inode_info *ci, int flags)
/*
* keep RD only if we didn't have the file open RW,
* because then the mds would revoke it anyway to
- * journal max_size=0.
+ * journal max_size=0. Keep LAZYIO with it: a lazy
+ * I/O open gets it issued in LOCK_SYNC, and giving
+ * it back costs a cap message per closed file, while
+ * the MDS revokes it along with CACHE when it must.
*/
if (ci->i_max_size == 0)
- retain |= CEPH_CAP_ANY_RD;
+ retain |= CEPH_CAP_ANY_RD | CEPH_CAP_FILE_LAZYIO;
}
}
--
2.53.0