From b38ec6f44adadef5e8838da24614edc60d08758b Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 8 Feb 2006 13:05:16 +0300 Subject: [PATCH] Apply the diskdata patch by Jonas. storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp: Apply the diskdata patch by Jonas: the patch adds a fallback to the standard I/O if O_DIRECT does not work. --- storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp index 6947a4902a1..41a705fea2d 100644 --- a/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp +++ b/storage/ndb/src/kernel/blocks/ndbfs/AsyncFile.cpp @@ -370,7 +370,6 @@ void AsyncFile::openReq(Request* request) const int mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; -retry: if(flags & FsOpenReq::OM_CREATE_IF_NONE){ if((theFd = ::open(theFileName.c_str(), new_flags, mode)) != -1) { close(theFd); @@ -449,9 +448,21 @@ retry: } 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); unlink(theFileName.c_str()); - request->error = errno; + request->error = err; return; } off += request->par.open.page_size;