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
This commit is contained in:
parent
f1a02a8e1e
commit
efdcada6f3
6
src/system/kernel/cache/block_cache.cpp
vendored
6
src/system/kernel/cache/block_cache.cpp
vendored
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user