From f5511c9b9f0a3a5b65bacdb5a47d08b2f81018ca Mon Sep 17 00:00:00 2001 From: Patrick Donnelly Date: Tue, 27 May 2025 10:20:22 -0400 Subject: [PATCH] mds: fix test that directory has no snaps To look if the directory's first is beyond the last snap. This matches the behavior of lssnaps. Signed-off-by: Patrick Donnelly Fixes: https://tracker.ceph.com/issues/71462 (cherry picked from commit c22db4e683cf2e6b0decc937e9ab92ba15d46487) --- src/mds/Server.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 931c1104f3f..9e09abb1f13 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -8915,7 +8915,9 @@ bool Server::_dir_has_snaps(const MDRequestRef& mdr, CInode *diri) ceph_assert(diri->snaplock.can_read(mdr->get_client())); SnapRealm *realm = diri->find_snaprealm(); - return !realm->get_snaps().empty(); + auto& snaps = realm->get_snaps(); + auto it = snaps.lower_bound(diri->get_oldest_snap()); + return it != snaps.end(); } bool Server::_dir_is_nonempty(const MDRequestRef& mdr, CInode *in) -- 2.39.5