This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.2.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit b701fceb0ce2256d70f691cca78e074c8dcd8632
Author: Mo Chen <moc...@apache.org>
AuthorDate: Mon Sep 25 15:54:48 2023 -0500

    Abort a read when the disk is known to be bad (#10286)
    
    * Abort a read when the disk is known to be bad
    
    Reads on a known bad disk can read corrupt cache metadata, which causes
    a crash.  Abort reads early on a bad disk so that ATS is less likely to
    crash after a disk is marked bad.
    
    (cherry picked from commit bc8bfa6acd38841cd0814ae01907c756d9913088)
---
 iocore/cache/Cache.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 41faf0659d..20671bd780 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -2188,6 +2188,11 @@ CacheVC::handleReadDone(int event, Event *e)
   } else if (is_io_in_progress()) {
     return EVENT_CONT;
   }
+  if (DISK_BAD(vol->disk)) {
+    io.aio_result = -1;
+    Warning("Canceling cache read: disk %s is bad.", vol->hash_text.get());
+    goto Ldone;
+  }
   {
     MUTEX_TRY_LOCK(lock, vol->mutex, mutex->thread_holding);
     if (!lock.is_locked()) {

Reply via email to