From efdcada6f30bd510641bfda1b15ab374bc22c04a Mon Sep 17 00:00:00 2001 From: "Ithamar R. Adema" Date: Mon, 30 Mar 2015 19:23:07 +0200 Subject: [PATCH] BlockWriter: Do not panic on failing read/writes These were here for debugging purposes, as often it is a sign of inconsistencies. However, for USB disks this is a normal occurence when someone janks out of the device without unmounting first. Make sure we log these cases though, as it still helps debugging. Fix sponsered by http://www.izcorp.com --- src/system/kernel/cache/block_cache.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/system/kernel/cache/block_cache.cpp b/src/system/kernel/cache/block_cache.cpp index 36af948840..ce08c5dba9 100644 --- a/src/system/kernel/cache/block_cache.cpp +++ b/src/system/kernel/cache/block_cache.cpp @@ -40,6 +40,8 @@ # define TRACE(x) ; #endif +#define TRACE_ALWAYS(x) dprintf x + // This macro is used for fatal situations that are acceptable in a running // system, like out of memory situations - should only panic for debugging. #define FATAL(x) panic x @@ -1239,7 +1241,7 @@ BlockWriter::_WriteBlock(cached_block* block) if (written != (ssize_t)blockSize) { TB(Error(fCache, block->block_number, "write failed", written)); - FATAL(("could not write back block %" B_PRIdOFF " (%s)\n", block->block_number, + TRACE_ALWAYS(("could not write back block %" B_PRIdOFF " (%s)\n", block->block_number, strerror(errno))); if (written < 0) return errno; @@ -1902,7 +1904,7 @@ retry: cache->RemoveBlock(block); TB(Error(cache, blockNumber, "read failed", bytesRead)); - FATAL(("could not read block %" B_PRIdOFF ": bytesRead: %zd, error: %s\n", + TRACE_ALWAYS(("could not read block %" B_PRIdOFF ": bytesRead: %zd, error: %s\n", blockNumber, bytesRead, strerror(errno))); return NULL; }