diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2014-09-19 01:07:32 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2014-09-19 01:12:03 +0200 |
commit | b0bd8ce4086531f4f83ce417ddb988d8b4e0907a (patch) | |
tree | dcc4857d38a02cf164fe24f2d30e0b421448788b | |
parent | 2263a3bcf559ef1eba68a6ef6216aca4deaf4d3e (diff) | |
download | lvm2-b0bd8ce4086531f4f83ce417ddb988d8b4e0907a.tar.gz |
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.
-rw-r--r-- | lib/mm/memlock.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c index a58efd9e4..06588004f 100644 --- a/lib/mm/memlock.c +++ b/lib/mm/memlock.c @@ -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; |