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

mochen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/trafficserver.git


The following commit(s) were added to refs/heads/master by this push:
     new bc8bfa6acd Abort a read when the disk is known to be bad (#10286)
bc8bfa6acd is described below

commit bc8bfa6acd38841cd0814ae01907c756d9913088
Author: Mo Chen <[email protected]>
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.
---
 iocore/cache/Cache.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/iocore/cache/Cache.cc b/iocore/cache/Cache.cc
index 37fa3c14e0..178663df71 100644
--- a/iocore/cache/Cache.cc
+++ b/iocore/cache/Cache.cc
@@ -2183,6 +2183,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