未验证 提交 a3b5fca0 编写于 作者: S Shengliang Guan 提交者: GitHub

Merge pull request #19409 from taosdata/FIX/xsren/osFileUnlock

fix:Deadlock caused by assert modification
...@@ -368,6 +368,9 @@ int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count) { ...@@ -368,6 +368,9 @@ int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count) {
#endif #endif
ASSERT(pFile->fd >= 0); // Please check if you have closed the file. ASSERT(pFile->fd >= 0); // Please check if you have closed the file.
if (pFile->fd < 0) { if (pFile->fd < 0) {
#if FILE_WITH_LOCK
taosThreadRwlockUnlock(&(pFile->rwlock));
#endif
return -1; return -1;
} }
int64_t leftbytes = count; int64_t leftbytes = count;
...@@ -415,6 +418,9 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset) ...@@ -415,6 +418,9 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset)
#endif #endif
ASSERT(pFile->fd >= 0); // Please check if you have closed the file. ASSERT(pFile->fd >= 0); // Please check if you have closed the file.
if (pFile->fd < 0) { if (pFile->fd < 0) {
#if FILE_WITH_LOCK
taosThreadRwlockUnlock(&(pFile->rwlock));
#endif
return -1; return -1;
} }
#ifdef WINDOWS #ifdef WINDOWS
...@@ -479,6 +485,9 @@ int64_t taosPWriteFile(TdFilePtr pFile, const void *buf, int64_t count, int64_t ...@@ -479,6 +485,9 @@ int64_t taosPWriteFile(TdFilePtr pFile, const void *buf, int64_t count, int64_t
#endif #endif
ASSERT(pFile->fd >= 0); // Please check if you have closed the file. ASSERT(pFile->fd >= 0); // Please check if you have closed the file.
if (pFile->fd < 0) { if (pFile->fd < 0) {
#if FILE_WITH_LOCK
taosThreadRwlockUnlock(&(pFile->rwlock));
#endif
return 0; return 0;
} }
#ifdef WINDOWS #ifdef WINDOWS
......
...@@ -724,9 +724,6 @@ void putBackAutoPtr(int type, STire* tire) { ...@@ -724,9 +724,6 @@ void putBackAutoPtr(int type, STire* tire) {
} else { } else {
tires[type]->ref--; tires[type]->ref--;
ASSERT(tires[type]->ref > 0); ASSERT(tires[type]->ref > 0);
if (tires[type]->ref <= 0) {
return;
}
} }
taosThreadMutexUnlock(&tiresMutex); taosThreadMutexUnlock(&tiresMutex);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册