1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

memlock: drop locked mem in critical section

When daemon releases memory and it is still in critical
section, issue an error message and drop memory.

We cannot do anything better for now and we at least
release allocated resource.

FIXME:

This code is triggered when i.e. clvmd is killed while
some LVs are suspend - in this case suspended devices leak,
so if this happens during i.e. clvmd upgrade we have
unresolved problem - even locked rootfs...
This commit is contained in:
Zdenek Kabelac 2014-03-20 13:53:39 +01:00
parent 0ca16c6946
commit 486b15d36c

View File

@ -456,6 +456,11 @@ void memlock_dec_daemon(struct cmd_context *cmd)
log_error(INTERNAL_ERROR "_memlock_count_daemon has dropped below 0.");
--_memlock_count_daemon;
log_debug_mem("memlock_count_daemon dec to %d", _memlock_count_daemon);
if (!_memlock_count_daemon && _critical_section && _mem_locked) {
log_error("Unlocking daemon memory in critical section.");
_unlock_mem(cmd);
_mem_locked = 0;
}
_unlock_mem_if_possible(cmd);
}