From c22db4e683cf2e6b0decc937e9ab92ba15d46487 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 --- 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 65033c052af78..7a9eac8378273 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -9241,7 +9241,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.47.3