diff options
author | Tad Marshall <tad@10gen.com> | 2012-06-20 05:07:54 -0400 |
---|---|---|
committer | Tad Marshall <tad@10gen.com> | 2012-06-20 13:18:02 -0400 |
commit | 47ea9f70ddb90ffba8788b5ed4ddfc72237e6c9d (patch) | |
tree | 17d87d44120171d3a8d5adfe73e034430e47b967 /src/mongo/util/mmap_win.cpp | |
parent | f641164ba14d8064c643c231adf53d8ca9bf4963 (diff) | |
download | mongo-47ea9f70ddb90ffba8788b5ed4ddfc72237e6c9d.tar.gz |
SERVER-6132 makeChunkWritable abort on failure (Windows)
Diffstat (limited to 'src/mongo/util/mmap_win.cpp')
-rw-r--r-- | src/mongo/util/mmap_win.cpp | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/mongo/util/mmap_win.cpp b/src/mongo/util/mmap_win.cpp index 8bc7097c144..2a334254e3f 100644 --- a/src/mongo/util/mmap_win.cpp +++ b/src/mongo/util/mmap_win.cpp @@ -259,12 +259,21 @@ namespace mongo { size_t protectSize = protectEnd - protectStart; dassert(protectSize>0&&protectSize<=MemoryMappedFile::ChunkSize); - DWORD old; - bool ok = VirtualProtect((void*)protectStart, protectSize, PAGE_WRITECOPY, &old); - if( !ok ) { - DWORD e = GetLastError(); - log() << "VirtualProtect failed (mcw) " << mmf->filename() << ' ' << chunkno << hex << protectStart << ' ' << protectSize << ' ' << errnoWithDescription(e) << endl; - verify(false); + DWORD oldProtection; + bool ok = VirtualProtect( reinterpret_cast<void*>( protectStart ), + protectSize, + PAGE_WRITECOPY, + &oldProtection ); + if ( !ok ) { + DWORD dosError = GetLastError(); + log() << "VirtualProtect for " << mmf->filename() + << " chunk " << chunkno + << " failed with " << errnoWithDescription( dosError ) + << " (chunk size is " << protectSize + << ", address is " << hex << protectStart << dec << ")" + << " in mongo::makeChunkWritable, terminating" + << endl; + fassertFailed( 16362 ); } } |