提交 52bfe618 编写于 作者: wafwerar's avatar wafwerar

[TD-13062]<fix>: file system write fsync error

上级 7ba4e6f4
...@@ -240,6 +240,7 @@ int64_t taosCloseFile(TdFilePtr *ppFile) { ...@@ -240,6 +240,7 @@ int64_t taosCloseFile(TdFilePtr *ppFile) {
return 0; return 0;
} }
fflush((*ppFile)->fp); fflush((*ppFile)->fp);
fsync((*ppFile)->fd);
close((*ppFile)->fd); close((*ppFile)->fd);
(*ppFile)->fd = -1; (*ppFile)->fd = -1;
(*ppFile)->fp = NULL; (*ppFile)->fp = NULL;
...@@ -295,12 +296,14 @@ int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count) { ...@@ -295,12 +296,14 @@ int64_t taosWriteFile(TdFilePtr pFile, const void *buf, int64_t count) {
if (errno == EINTR) { if (errno == EINTR) {
continue; continue;
} }
fsync(pFile->fd);
return -1; return -1;
} }
nleft -= nwritten; nleft -= nwritten;
tbuf += nwritten; tbuf += nwritten;
} }
fsync(pFile->fd);
return count; return count;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册