]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgwlc: fix removing LCEntry 47005/head
authorTongliang Deng <dengtongliang@gmail.com>
Thu, 7 Jul 2022 10:42:53 +0000 (10:42 +0000)
committerTongliang Deng <dengtongliang@gmail.com>
Thu, 7 Jul 2022 11:22:41 +0000 (11:22 +0000)
When `bucket_lc_process` returns `-ENOENT`, the lc entry is removed,
but `set_entry(...)` is called after the removal which will give us
the unwanted lc entry again.

Fixes: c069eb7ff09b52003fa00a5cc83b1e52370032f5.
Signed-off-by: Tongliang Deng <dengtongliang@gmail.com>
src/rgw/rgw_lc.cc

index c4604d3e4fecec838bfce6460db7b558b3dc2539..1cfd4d05918ea27b42fd52205a6fa79e6046c79b 100644 (file)
@@ -2122,7 +2122,7 @@ int RGWLC::process(int index, int max_lock_secs, LCWorker* worker,
          if (advance_head(lc_shard, *head.get(), *entry.get(), now) < 0) {
            goto exit;
          }
-             /* done with this shard */
+         /* done with this shard */
          if (head->get_marker().empty()) {
            ldpp_dout(this, 5) <<
              "RGWLC::process() cycle finished lc_shard="
@@ -2227,17 +2227,20 @@ int RGWLC::process(int index, int max_lock_secs, LCWorker* worker,
                           << dendl;
        /* not fatal, could result from a race */
       }
-    } else if (ret < 0) {
-      entry->set_status(lc_failed);
     } else {
-      entry->set_status(lc_complete);
-    }
-    ret = sal_lc->set_entry(lc_shard,  *entry);
-    if (ret < 0) {
-      ldpp_dout(this, 0) << "RGWLC::process() failed to set entry on "
-          << lc_shard << dendl;
-      /* fatal, locked */
-      goto exit;
+      if (ret < 0) {
+        entry->set_status(lc_failed);
+      } else {
+        entry->set_status(lc_complete);
+      }
+      ret = sal_lc->set_entry(lc_shard, *entry);
+      if (ret < 0) {
+        ldpp_dout(this, 0) << "RGWLC::process() failed to set entry on "
+                           << lc_shard
+                           << dendl;
+        /* fatal, locked */
+        goto exit;
+      }
     }
 
     /* done with this shard */
@@ -2257,12 +2260,9 @@ int RGWLC::process(int index, int max_lock_secs, LCWorker* worker,
     }
   } while(1 && !once && !going_down());
 
-notlocked:
-  delete lock;
-  return 0;
-
 exit:
   lock->unlock();
+notlocked:
   delete lock;
   return 0;
 }