-
Type: Bug
-
Resolution: Done
-
Priority: Trivial - P5
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Environment:Found and fixed on Linux, but I believe the problem to be generic
-
ALL
The code to allocate new data files reads as follows:
try {
log() << "allocating new datafile " << name << ", filling with zeroes..." << endl;
long fd = open(name.c_str(), O_CREAT | O_RDWR | O_NOATIME, S_IRUSR | S_IWUSR);
if ( fd <= 0 )
The sense of the conditional on the massert() is inverted. The block is only
entered for an invalid file descriptor, hence within it fd is always <= 0. As
a result, the massert() never actually triggers, and so the error is neither
logged nor trapped at this point.
This isn't actually a big problem, as the invalid value in fd (typically -1)
causes the system calls within ensureLength() to fail pretty soon after.
(The posix_fallocate() fails and warns, and then the fallback code fails the
first lseek(), logs and aborts).
Patches attached for master, and for 1.6.6
Nicholas Clark