Commit 0831fd61 authored by konstantin@mysql.com's avatar konstantin@mysql.com

Apply the diskdata patch by Jonas.

parent 7452faa5
...@@ -370,7 +370,6 @@ void AsyncFile::openReq(Request* request) ...@@ -370,7 +370,6 @@ void AsyncFile::openReq(Request* request)
const int mode = S_IRUSR | S_IWUSR | const int mode = S_IRUSR | S_IWUSR |
S_IRGRP | S_IWGRP | S_IRGRP | S_IWGRP |
S_IROTH | S_IWOTH; S_IROTH | S_IWOTH;
retry:
if(flags & FsOpenReq::OM_CREATE_IF_NONE){ if(flags & FsOpenReq::OM_CREATE_IF_NONE){
if((theFd = ::open(theFileName.c_str(), new_flags, mode)) != -1) { if((theFd = ::open(theFileName.c_str(), new_flags, mode)) != -1) {
close(theFd); close(theFd);
...@@ -449,9 +448,21 @@ void AsyncFile::openReq(Request* request) ...@@ -449,9 +448,21 @@ void AsyncFile::openReq(Request* request)
} }
if(size != 0) if(size != 0)
{ {
int err = errno;
#ifdef O_DIRECT
if ((new_flags & O_DIRECT) && off == 0)
{
ndbout_c("error on first write(%d), disable O_DIRECT", err);
new_flags &= ~O_DIRECT;
close(theFd);
theFd = ::open(theFileName.c_str(), new_flags, mode);
if (theFd != -1)
continue;
}
#endif
close(theFd); close(theFd);
unlink(theFileName.c_str()); unlink(theFileName.c_str());
request->error = errno; request->error = err;
return; return;
} }
off += request->par.open.page_size; off += request->par.open.page_size;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment