mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-19 23:58:22 +08:00
mdbx: логирование ошибок при открытии lck-файла.
This commit is contained in:
parent
8408a2eed3
commit
e5fe279632
25
src/lck.c
25
src/lck.c
@ -133,28 +133,33 @@ __cold int lck_setup(MDBX_env *env, mdbx_mode_t mode) {
|
|||||||
int err = osal_openfile(MDBX_OPEN_LCK, env, env->pathname.lck, &env->lck_mmap.fd, mode);
|
int err = osal_openfile(MDBX_OPEN_LCK, env, env->pathname.lck, &env->lck_mmap.fd, mode);
|
||||||
if (err != MDBX_SUCCESS) {
|
if (err != MDBX_SUCCESS) {
|
||||||
switch (err) {
|
switch (err) {
|
||||||
default:
|
|
||||||
return err;
|
|
||||||
case MDBX_EACCESS:
|
case MDBX_EACCESS:
|
||||||
case MDBX_EPERM:
|
case MDBX_EPERM:
|
||||||
if (!F_ISSET(env->flags, MDBX_RDONLY | MDBX_EXCLUSIVE))
|
if (F_ISSET(env->flags, MDBX_RDONLY | MDBX_EXCLUSIVE))
|
||||||
return err;
|
|
||||||
break;
|
break;
|
||||||
|
__fallthrough /* fall through */;
|
||||||
case MDBX_ENOFILE:
|
case MDBX_ENOFILE:
|
||||||
case MDBX_EROFS:
|
case MDBX_EROFS:
|
||||||
if ((env->flags & MDBX_RDONLY) == 0)
|
if (env->flags & MDBX_RDONLY) {
|
||||||
return err;
|
|
||||||
/* ENSURE the file system is read-only */
|
/* ENSURE the file system is read-only */
|
||||||
err = osal_check_fs_rdonly(env->lazy_fd, env->pathname.lck, err);
|
int err_rofs = osal_check_fs_rdonly(env->lazy_fd, env->pathname.lck, err);
|
||||||
if (err != MDBX_SUCCESS &&
|
if (err_rofs == MDBX_SUCCESS ||
|
||||||
/* ignore ERROR_NOT_SUPPORTED for exclusive mode */
|
/* ignore ERROR_NOT_SUPPORTED for exclusive mode */
|
||||||
!(err == MDBX_ENOSYS && (env->flags & MDBX_EXCLUSIVE)))
|
(err_rofs == MDBX_ENOSYS && (env->flags & MDBX_EXCLUSIVE)))
|
||||||
return err;
|
|
||||||
break;
|
break;
|
||||||
|
if (err_rofs != MDBX_ENOSYS)
|
||||||
|
err = err_rofs;
|
||||||
|
}
|
||||||
|
__fallthrough /* fall through */;
|
||||||
|
default:
|
||||||
|
ERROR("unable to open lck-file %" MDBX_PRIsPATH ", env-flags 0x%X, err %d", env->pathname.lck, env->flags, err);
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* LY: without-lck mode (e.g. exclusive or on read-only filesystem) */
|
/* LY: without-lck mode (e.g. exclusive or on read-only filesystem) */
|
||||||
env->lck_mmap.fd = INVALID_HANDLE_VALUE;
|
env->lck_mmap.fd = INVALID_HANDLE_VALUE;
|
||||||
|
NOTICE("continue %" MDBX_PRIsPATH " within without-lck mode, env-flags 0x%X, lck-error %d", env->pathname.dxb,
|
||||||
|
env->flags, err);
|
||||||
}
|
}
|
||||||
|
|
||||||
rthc_lock();
|
rthc_lock();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user