diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2011-08-09 11:44:57 +0000 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2011-08-09 11:44:57 +0000 |
commit | cf9927697bb34bf936767ca285b85f6687e785d7 (patch) | |
tree | a778fe90daaf7a859d5306f747879ae1e0f9edbb /lib/locking/file_locking.c | |
parent | 0127a9a525cec688e174dbae5b0033682496d78c (diff) | |
download | lvm2-cf9927697bb34bf936767ca285b85f6687e785d7.tar.gz lvm2-cf9927697bb34bf936767ca285b85f6687e785d7.tar.xz lvm2-cf9927697bb34bf936767ca285b85f6687e785d7.zip |
Suppress low-level locking errors and warnings while using --sysinit.
Today, we use "suppress_messages" flag (set internally in init_locking fn based
on 'ignorelockingfailure() && getenv("LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES")'.
This way, we can suppress high level messages like "File-based locking
initialisation failed" or "Internal cluster locking initialisation failed".
However, each locking has its own sequence of initialization steps and these
could log some errors as well. It's quite misleading for the user to see such
errors and warnings if the "--sysinit" is used (and so the ignorelockingfailure
&& LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES environment variable). Errors and
warnings from these intermediary steps should be suppressed as well if requested.
This patch propagates the "suppress_messages" flag deeper into locking init
functions. I've also added these flags for other locking types for consistency,
though it's not actually used for no_locking and readonly_locking.
Diffstat (limited to 'lib/locking/file_locking.c')
-rw-r--r-- | lib/locking/file_locking.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/locking/file_locking.c b/lib/locking/file_locking.c index b3d62b54..93c1e1bd 100644 --- a/lib/locking/file_locking.c +++ b/lib/locking/file_locking.c @@ -332,7 +332,8 @@ static int _file_lock_resource(struct cmd_context *cmd, const char *resource, return 1; } -int init_file_locking(struct locking_type *locking, struct cmd_context *cmd) +int init_file_locking(struct locking_type *locking, struct cmd_context *cmd, + int suppress_messages) { int r; @@ -364,12 +365,14 @@ int init_file_locking(struct locking_type *locking, struct cmd_context *cmd) dm_list_init(&_lock_list); if (sigfillset(&_intsigset) || sigfillset(&_fullsigset)) { - log_sys_error("sigfillset", "init_file_locking"); + log_sys_error_suppress(suppress_messages, "sigfillset", + "init_file_locking"); return 0; } if (sigdelset(&_intsigset, SIGINT)) { - log_sys_error("sigdelset", "init_file_locking"); + log_sys_error_suppress(suppress_messages, "sigdelset", + "init_file_locking"); return 0; } |