]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: Fix duplicate client entries in list to avoid multiple client evictions 30951/head
authorSidharth Anupkrishnan <sanupkri@redhat.com>
Wed, 16 Oct 2019 01:24:08 +0000 (06:54 +0530)
committerSidharth Anupkrishnan <sanupkri@redhat.com>
Fri, 18 Oct 2019 11:46:19 +0000 (17:16 +0530)
Cannot be cherry-picked from master because the container to be changed that's being used in nautilus is std::list instead of std::vector

Fixes: https://tracker.ceph.com/issues/41585
Signed-off-by: Sidharth Anupkrishnan <sanupkri@redhat.com>
(manual backport of f4afb43f3649161516f2350df9fd1d918b13736b)

src/mds/Locker.cc

index 5239dd270f0c7b577e8920cb58a0b1f21e230b45..f00b97910054f7cedcb5c969a507fd58ad5671b3 100644 (file)
@@ -3620,7 +3620,10 @@ void Locker::get_late_revoking_clients(std::list<client_t> *result,
   // Slow path: execute in O(N_clients)
   for (auto &p : revoking_caps_by_client) {
     if (any_late_revoking_caps(p.second, timeout)) {
-      result->push_back(p.first);
+      // Search the list for duplicate and only insert if unique
+      std::list<client_t>::const_iterator it = std::find(result->begin(), result->end(), p.first);
+      if (it == result->end())
+        result->push_back(p.first);
     }
   }
 }