1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-28 03:27:58 +03:00

memlock: ensure memory is allocation before locking

strerror may mmap ram if it was not yet used.
dm_udev_get_sync_support  may initilize udev if it was still not used.
This commit is contained in:
Zdenek Kabelac 2014-09-19 01:07:32 +02:00
parent 2263a3bcf5
commit b0bd8ce408

View File

@ -266,9 +266,6 @@ static int _memlock_maps(struct cmd_context *cmd, lvmlock_t lock, size_t *mstats
#endif
}
/* Force libc.mo load */
if (lock == LVM_MLOCK)
(void)strerror(0);
/* Reset statistic counters */
*mstats = 0;
@ -442,6 +439,9 @@ static void _lock_mem(struct cmd_context *cmd)
stack;
}
(void)strerror(0); /* Force libc.mo load */
(void)dm_udev_get_sync_support(); /* udev is initialized */
log_very_verbose("Locking memory");
if (!_memlock_maps(cmd, LVM_MLOCK, &_mstats))
stack;