From: Alex Rousskov Date: Sat, 29 Jan 2011 00:08:52 +0000 (-0700) Subject: Added a configuration check to prevent IoState::startWriting() assertions. X-Git-Tag: take01~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=344d132f84e7f4b502b7c98fdf9dac605106710d;p=thirdparty%2Fsquid.git Added a configuration check to prevent IoState::startWriting() assertions. Rock::IoState::startWriting() asserts that [padded] write request size does not exceed the slot size. Padded request size always exceeds the slot size for slots smaller than the page. This check may also help avoid using unallocated buffer for padding, but that part may need more work. --- diff --git a/src/fs/rock/RockSwapDir.cc b/src/fs/rock/RockSwapDir.cc index 0bdf80517b..7bad86b11a 100644 --- a/src/fs/rock/RockSwapDir.cc +++ b/src/fs/rock/RockSwapDir.cc @@ -165,6 +165,15 @@ Rock::SwapDir::validateOptions() if (max_objsize <= 0) fatal("Rock store requires a positive max-size"); + // Rock::IoState::startWriting() inflates write size to the end of the page + // so that mmap does not have to read the tail and then write it back. + // This is a weak check that the padded area will be allocated by [growing] + // MemBuf and a sufficient check that inflated size will not exceed the + // slot size. + static const int ps = getpagesize(); + if (ps > 0 && (max_objsize % ps != 0)) + fatal("Rock store max-size should be a multiple of page size"); + const int64_t eLimitHi = 0xFFFFFF; // Core sfileno maximum const int64_t eLimitLo = map.entryLimit(); // dynamic shrinking unsupported const int64_t eWanted = (maximumSize() - HeaderSize)/max_objsize;