diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2021-09-27 15:52:41 +0200 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2021-09-27 18:56:13 +0200 |
commit | 3a3aabb8326c3ccfb9266663b538b9769ebccf28 (patch) | |
tree | db690f39de7d99ca1bd1b174f4dea3460e6430fc | |
parent | 61a6f9905e87e650f0bddae83fec6923bb100a57 (diff) | |
download | lvm2-3a3aabb8326c3ccfb9266663b538b9769ebccf28.tar.gz |
metadata: avoid excessive check of /etc/localtime
With larger metadata, decoding 'localtime()' for hinting time creation
of every LV may cause excessive check of /etc/localtime file.
Set TZ to ":/etc/localtime" so glibc reads this file just once
instead of check everytime if there has anything changed.
-rw-r--r-- | tools/lvmcmdline.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c index 7c5930006..1fc2dc3bb 100644 --- a/tools/lvmcmdline.c +++ b/tools/lvmcmdline.c @@ -3043,6 +3043,11 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv) int skip_hyphens; int refresh_done = 0; + /* Avoid excessive access to /etc/localtime and set TZ variable for glibc + * so it does not need to check /etc/localtime everytime that needs that info */ + if (!getenv("TZ")) + setenv("TZ", ":/etc/localtime", 0); + init_error_message_produced(0); /* each command should start out with sigint flag cleared */ |