JosiahWI commented on code in PR #13927:
URL: https://github.com/apache/trafficserver/pull/13927#discussion_r4443538783


##########
src/iocore/cache/CacheVC.cc:
##########
@@ -973,11 +977,18 @@ CacheVC::scanOpenWrite(int /* event ATS_UNUSED */, Event 
* /* e ATS_UNUSED */)
 {
   Dbg(dbg_ctl_cache_scan_truss, "inside %p:scanOpenWrite", this);
   cancel_trigger();
+  if (_action.cancelled) {
+    return free_CacheVC(this);
+  }
   // get volume lock
   if (writer_lock_retry > SCAN_WRITER_LOCK_MAX_RETRY) {
-    int r = 
_action.continuation->handleEvent(CACHE_EVENT_SCAN_OPERATION_BLOCKED, nullptr);
+    auto r = _action.call_back(CACHE_EVENT_SCAN_OPERATION_BLOCKED, nullptr);
     Dbg(dbg_ctl_cache_scan, "still haven't got the writer lock, asking 
user..");
-    switch (r) {
+    // The handler may have cancelled the scan.
+    if (_action.cancelled) {
+      return free_CacheVC(this);
+    }
+    switch (*r) {
     case CACHE_SCAN_RESULT_RETRY:

Review Comment:
   Not an issue (cancellation check is equivalent), but will make clearer.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to