mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-15 18:54:29 +08:00
mdbx: улучшение авто-переключения в режим without-lck при открытии БД на read-only-носителе.
This commit is contained in:
parent
92a49c7c8c
commit
0297136648
@ -135,25 +135,22 @@ __cold int lck_setup(MDBX_env *env, mdbx_mode_t mode) {
|
||||
switch (err) {
|
||||
default:
|
||||
return err;
|
||||
case MDBX_ENOFILE:
|
||||
case MDBX_EACCESS:
|
||||
case MDBX_EPERM:
|
||||
if (!F_ISSET(env->flags, MDBX_RDONLY | MDBX_EXCLUSIVE))
|
||||
return err;
|
||||
break;
|
||||
case MDBX_ENOFILE:
|
||||
case MDBX_EROFS:
|
||||
if ((env->flags & MDBX_RDONLY) == 0)
|
||||
return err;
|
||||
break;
|
||||
}
|
||||
|
||||
if (err != MDBX_ENOFILE) {
|
||||
/* ENSURE the file system is read-only */
|
||||
err = osal_check_fs_rdonly(env->lazy_fd, env->pathname.lck, err);
|
||||
if (err != MDBX_SUCCESS &&
|
||||
/* ignore ERROR_NOT_SUPPORTED for exclusive mode */
|
||||
!(err == MDBX_ENOSYS && (env->flags & MDBX_EXCLUSIVE)))
|
||||
return err;
|
||||
break;
|
||||
}
|
||||
|
||||
/* LY: without-lck mode (e.g. exclusive or on read-only filesystem) */
|
||||
|
Loading…
x
Reference in New Issue
Block a user