]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix test that directory has no snaps 63524/head
authorPatrick Donnelly <pdonnell@ibm.com>
Tue, 27 May 2025 14:20:22 +0000 (10:20 -0400)
committerPatrick Donnelly <pdonnell@ibm.com>
Tue, 27 May 2025 14:51:05 +0000 (10:51 -0400)
To look if the directory's first is beyond the last snap. This matches the behavior of lssnaps.

Signed-off-by: Patrick Donnelly <pdonnell@ibm.com>
Fixes: https://tracker.ceph.com/issues/71462
src/mds/Server.cc

index 65033c052af788cf195f730bac984681f5a11d11..7a9eac837827389ca13966c3c44f2727e9e9c4a8 100644 (file)
@@ -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)