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

fix:Deadlock caused by assert modification
This commit is contained in:
Shengliang Guan 2023-01-08 09:42:20 +08:00 committed by GitHub
commit a3b5fca070
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View File

@ -368,6 +368,9 @@ int64_t taosReadFile(TdFilePtr pFile, void *buf, int64_t count) {
#endif
ASSERT(pFile->fd >= 0); // Please check if you have closed the file.
if (pFile->fd < 0) {
#if FILE_WITH_LOCK
taosThreadRwlockUnlock(&(pFile->rwlock));
#endif
return -1;
}
int64_t leftbytes = count;
@ -415,6 +418,9 @@ int64_t taosPReadFile(TdFilePtr pFile, void *buf, int64_t count, int64_t offset)
#endif
ASSERT(pFile->fd >= 0); // Please check if you have closed the file.
if (pFile->fd < 0) {
#if FILE_WITH_LOCK
taosThreadRwlockUnlock(&(pFile->rwlock));
#endif
return -1;
}
#ifdef WINDOWS
@ -479,6 +485,9 @@ int64_t taosPWriteFile(TdFilePtr pFile, const void *buf, int64_t count, int64_t
#endif
ASSERT(pFile->fd >= 0); // Please check if you have closed the file.
if (pFile->fd < 0) {
#if FILE_WITH_LOCK
taosThreadRwlockUnlock(&(pFile->rwlock));
#endif
return 0;
}
#ifdef WINDOWS

View File

@ -724,9 +724,6 @@ void putBackAutoPtr(int type, STire* tire) {
} else {
tires[type]->ref--;
ASSERT(tires[type]->ref > 0);
if (tires[type]->ref <= 0) {
return;
}
}
taosThreadMutexUnlock(&tiresMutex);