]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mds: Fix duplicate client entries in list to avoid multiple client evictions 30950/head
authorSidharth Anupkrishnan <sanupkri@redhat.com>
Wed, 16 Oct 2019 01:05:51 +0000 (06:35 +0530)
committerSidharth Anupkrishnan <sanupkri@redhat.com>
Fri, 18 Oct 2019 11:42:10 +0000 (17:12 +0530)
Cannot be cherry-picked from master because the container to be changed that's being used in mimic 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 e73454c70f6b3986d0f4a247c9f3de42b903ff50..6125a30e117717d7479ab57663724b10f0b295dd 100644 (file)
@@ -3662,7 +3662,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);
     }
   }
 }