]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: fix test that directory has no snaps 65259/head
authorPatrick Donnelly <pdonnell@ibm.com>
Tue, 27 May 2025 14:20:22 +0000 (10:20 -0400)
committerJos Collin <jcollin@redhat.com>
Wed, 27 Aug 2025 06:48:52 +0000 (12:18 +0530)
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
(cherry picked from commit c22db4e683cf2e6b0decc937e9ab92ba15d46487)

src/mds/Server.cc

index 6dd9b330972124aa70dc3c0e8a152636aa5847f7..6211be514c1de32c0795cd13181fdbc8ba1ee072 100644 (file)
@@ -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)