From: Patrick Donnelly Date: Tue, 27 May 2025 14:20:22 +0000 (-0400) Subject: mds: fix test that directory has no snaps X-Git-Tag: v20.2.1~38^2~24^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=68134edc406a82a6083b915fd318dfe7ff2b2f0f;p=ceph.git 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) --- diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 6dd9b330972..6211be514c1 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -8981,7 +8981,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)