]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os/seastore/transaction_manager: only add pin if not already pending
authorSamuel Just <sjust@redhat.com>
Thu, 20 Aug 2020 19:38:20 +0000 (12:38 -0700)
committerSamuel Just <sjust@redhat.com>
Wed, 23 Sep 2020 22:13:51 +0000 (15:13 -0700)
If it's already pending, cache.duplicate_for_write is a noop and the extent
will already have a pin.  Also, add some debugging.

Signed-off-by: Samuel Just <sjust@redhat.com>
src/crimson/os/seastore/transaction_manager.h

index c9c2eb0f594c1870560de9c99e180f35b76ee8f8..5b6f03f115195928b59cd88d7e9abb20687a6bda 100644 (file)
@@ -136,10 +136,25 @@ public:
 
   /// Obtain mutable copy of extent
   LogicalCachedExtentRef get_mutable_extent(Transaction &t, LogicalCachedExtentRef ref) {
+    auto &logger = crimson::get_logger(ceph_subsys_filestore);
     auto ret = cache.duplicate_for_write(
       t,
       ref)->cast<LogicalCachedExtent>();
-    ret->set_pin(ref->get_pin().duplicate());
+    if (!ret->has_pin()) {
+      logger.debug(
+       "{}: duplicating {} for write: {}",
+       __func__,
+       *ref,
+       *ret);
+      ret->set_pin(ref->get_pin().duplicate());
+    } else {
+      logger.debug(
+       "{}: {} already pending",
+       __func__,
+       *ref);
+      assert(ref->is_pending());
+      assert(&*ref == &*ret);
+    }
     return ret;
   }