Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion iocore/cache/CacheDisk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ CacheDisk::open(char *s, off_t blocks, off_t askip, int ahw_sector_size, int fil
}
}

//
// read disk header
SET_HANDLER(&CacheDisk::openStart);
io.aiocb.aio_offset = skip;
io.aiocb.aio_buf = (char *)header;
Expand Down Expand Up @@ -166,6 +166,10 @@ CacheDisk::openStart(int event, void * /* data ATS_UNUSED */)

if ((size_t)io.aiocb.aio_nbytes != (size_t)io.aio_result) {
Warning("could not read disk header for disk %s: declaring disk bad", path);

// the header could have random values by the AIO read error
memset(header, 0, header_len);

incrErrors(&io);
SET_DISK_BAD(this);
SET_HANDLER(&CacheDisk::openDone);
Expand Down