From e8fecd1eece757967bc3ca3f6da75abe3f2a34c5 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 7 Oct 2020 23:07:21 +0300 Subject: [PATCH] mdbx: fix opening DB on a network shares (pass MDBX_EXCLUSIVE from env). Change-Id: Ic5c68033ba81043ac7800f99aae364bf082c868f --- src/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core.c b/src/core.c index 4e102abb..5c3293be 100644 --- a/src/core.c +++ b/src/core.c @@ -10079,7 +10079,8 @@ static int __cold mdbx_setup_lck(MDBX_env *env, char *lck_pathname, } env->me_maxreaders = (unsigned)maxreaders; - err = mdbx_mmap(MDBX_WRITEMAP, &env->me_lck_mmap, (size_t)size, (size_t)size, + err = mdbx_mmap((env->me_flags & MDBX_EXCLUSIVE) | MDBX_WRITEMAP, + &env->me_lck_mmap, (size_t)size, (size_t)size, lck_seize_rc ? MMAP_OPTION_TRUNCATE | MMAP_OPTION_SEMAPHORE : MMAP_OPTION_SEMAPHORE); if (unlikely(err != MDBX_SUCCESS))