mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 17:04:13 +08:00
mdbx: fix mdbx_env_set_geometry() for case remap failed.
Change-Id: I0850692737eaee3c7f33194dfa19b88ce74497c8
This commit is contained in:
parent
8e8c00aadf
commit
c0be0d6fb7
@ -4523,6 +4523,7 @@ LIBMDBX_API int mdbx_env_set_geometry(MDBX_env *env, intptr_t size_lower,
|
|||||||
shrink_threshold = 1;
|
shrink_threshold = 1;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool need_unlock = false;
|
||||||
int rc = MDBX_PROBLEM;
|
int rc = MDBX_PROBLEM;
|
||||||
if (env->me_map) {
|
if (env->me_map) {
|
||||||
/* env already mapped */
|
/* env already mapped */
|
||||||
@ -4533,6 +4534,7 @@ LIBMDBX_API int mdbx_env_set_geometry(MDBX_env *env, intptr_t size_lower,
|
|||||||
int err = mdbx_txn_lock(env, false);
|
int err = mdbx_txn_lock(env, false);
|
||||||
if (unlikely(err != MDBX_SUCCESS))
|
if (unlikely(err != MDBX_SUCCESS))
|
||||||
return err;
|
return err;
|
||||||
|
need_unlock = true;
|
||||||
}
|
}
|
||||||
MDBX_meta *head = mdbx_meta_head(env);
|
MDBX_meta *head = mdbx_meta_head(env);
|
||||||
|
|
||||||
@ -4721,7 +4723,7 @@ LIBMDBX_API int mdbx_env_set_geometry(MDBX_env *env, intptr_t size_lower,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bailout:
|
bailout:
|
||||||
if (env->me_map && !inside_txn)
|
if (need_unlock)
|
||||||
mdbx_txn_unlock(env);
|
mdbx_txn_unlock(env);
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user