Skip to content

Commit e6e1f1e

Browse files
authored
Merge pull request #5494 from vpodzime/3.21.x-lmdb_close_lockfile
[3.21.x] Try to acquire file lock when closing DB
2 parents a251eda + 9ceeea7 commit e6e1f1e

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

libpromises/dbm_api.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -525,8 +525,14 @@ void CloseDB(DBHandle *handle)
525525
handle->refcount--;
526526
if (handle->refcount == 0)
527527
{
528+
FileLock lock = EMPTY_FILE_LOCK;
529+
bool locked = DBPathLock(&lock, handle->filename);
528530
DBPrivCloseDB(handle->priv);
529531
handle->open_tstamp = -1;
532+
if (locked)
533+
{
534+
DBPathUnLock(&lock);
535+
}
530536
}
531537
}
532538

0 commit comments

Comments
 (0)