Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e63b0c7262f50ab43fcde…
Commit: e63b0c7262f50ab43fcde1c50b6d880acab68407
Parent: 8f60c494515ddccb20e4afb804edb6b9599e65c0
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Tue Nov 29 10:04:17 2022 -0600
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Tue Nov 29 12:56:55 2022 -0600
lvmdbusd: Add command_log_selection to command line
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2145114
---
daemons/lvmdbusd/cmdhandler.py | 33 +++++++++++++++++----------------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index 0c7bd8528..9a76db4c9 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -17,7 +17,7 @@ import os
from lvmdbusd import cfg
from lvmdbusd.utils import pv_dest_ranges, log_debug, log_error, add_no_notify,\
- make_non_block, read_decoded, extract_stack_trace, LvmBug, add_config_option
+ make_non_block, read_decoded, extract_stack_trace, LvmBug, add_config_option, get_error_msg
from lvmdbusd.lvm_shell_proxy import LVMShellProxy
try:
@@ -121,6 +121,9 @@ def call_lvm(command, debug=False, line_cb=None,
command.insert(0, cfg.LVM_CMD)
command = add_no_notify(command)
+ # Ensure we get an error message when we fork & exec the lvm command line
+ command = add_config_option(command, "--config", 'log/command_log_selection="log_context!=''"')
+
process = Popen(command, stdout=PIPE, stderr=PIPE, close_fds=True,
env=os.environ)
@@ -167,7 +170,17 @@ def call_lvm(command, debug=False, line_cb=None,
if debug or (process.returncode != 0 and (process.returncode != 5 and "fullreport" in command)):
_debug_c(command, process.returncode, (stdout_text, stderr_text))
- return process.returncode, stdout_text, stderr_text
+ try:
+ report_json = json.loads(stdout_text)
+ except json.decoder.JSONDecodeError:
+ # Some lvm commands don't return json even though we are asking for it to do so.
+ return process.returncode, stdout_text, stderr_text
+
+ error_msg = get_error_msg(report_json)
+ if error_msg:
+ stderr_text += error_msg
+
+ return process.returncode, report_json, stderr_text
else:
if cfg.run.value == 0:
raise SystemExit
@@ -619,20 +632,8 @@ def lvm_full_report_json():
rc, out, err = call(cmd)
# When we have an exported vg the exit code of lvs or fullreport will be 5
if rc == 0 or rc == 5:
- # If the 'call' implementation is lvmshell, the out is a dictionary as lvmshell has to
- # parse the output to get the exit value. When doing fork & exec, out is a string
- # representing the JSON. TODO: Make this consistent between implementations.
- if cfg.SHELL_IN_USE:
- assert(type(out) == dict)
- return out
- else:
- try:
- return json.loads(out)
- except json.decoder.JSONDecodeError as joe:
- log_error("JSONDecodeError %s, \n JSON=\n%s\n" %
- (str(joe), out))
- raise LvmBug("'fullreport' returned invalid JSON")
-
+ assert(type(out) == dict)
+ return out
raise LvmBug("'fullreport' exited with code '%d'" % rc)
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=a5042375de3fd71469066…
Commit: a5042375de3fd7146906614bffbcc960349c2b20
Parent: ae916f77c92c1765c76fbb849a2eaeb5e0724768
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Fri Nov 25 15:45:47 2022 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Nov 25 16:41:53 2022 +0100
dmsetup: fix udev event handling for create
With newer kernels (>5.13) DM_CREATE no longer generates
uevent for DM devices without table.
There are even no sysfs block device entries in such case,
although device has asigned major:minor and it is being listed
by 'dmsetup info'.
So this patch calculates amount of 'table' lines and in case
no table line comes from cmdline or stdin - waiting on cookie
is avoided generically instead of disabling just case with
option --notable - which then also skipped handling of an
option --addnodeoncreate (which is however historical and
should be avoided)
As a result there should be no leaking udev cookies and endlessly
waiting commands like this:
dmsetup create mytestdev </dev/null
---
WHATS_NEW_DM | 1 +
libdm/dm-tools/dmsetup.c | 14 +++++++++-----
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index 1067312d3..71eee439f 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,5 +1,6 @@
Version 1.02.189 -
=====================================
+ Improve 'dmsetup create' without given table line with new kernels.
Version 1.02.187 - 10th November 2022
=====================================
diff --git a/libdm/dm-tools/dmsetup.c b/libdm/dm-tools/dmsetup.c
index 42eeead68..ea03d66c8 100644
--- a/libdm/dm-tools/dmsetup.c
+++ b/libdm/dm-tools/dmsetup.c
@@ -274,6 +274,7 @@ static char _disp_units = 's';
const char *_program_id = DM_STATS_PROGRAM_ID; /* program_id used for reports. */
static uint64_t _statstype = 0; /* stats objects to report */
static int _concise_output_produced = 0; /* Was any concise output already printed? */
+static int _added_target = 0; /* Count added target (no target -> no event) */
struct command;
static const struct command *_selection_cmd = NULL; /* Command to run against each device select with -S */
@@ -357,6 +358,8 @@ static int _parse_line(struct dm_task *dmt, char *buffer, const char *file,
if (!dm_task_add_target(dmt, start, size, ttype, ptr))
return_0;
+ _added_target++;
+
return 1;
}
@@ -1175,9 +1178,6 @@ static int _create_one_device(const char *name, const char *file)
_read_ahead_flags))
goto_out;
- if (_switches[NOTABLE_ARG])
- dm_udev_set_sync_support(0);
-
if (_switches[NOUDEVRULES_ARG])
udev_flags |= DM_UDEV_DISABLE_DM_RULES_FLAG |
DM_UDEV_DISABLE_SUBSYSTEM_RULES_FLAG;
@@ -1194,8 +1194,12 @@ static int _create_one_device(const char *name, const char *file)
if (_udev_only)
udev_flags |= DM_UDEV_DISABLE_LIBRARY_FALLBACK;
- if (!dm_task_set_cookie(dmt, &cookie, udev_flags) ||
- !_task_run(dmt))
+ if (_switches[NOTABLE_ARG] || !_added_target)
+ cookie = 0; // ADD event -> no udev event handling
+ else if (!dm_task_set_cookie(dmt, &cookie, udev_flags))
+ goto_out;
+
+ if (!_task_run(dmt))
goto_out;
r = 1;
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=ae916f77c92c1765c76fb…
Commit: ae916f77c92c1765c76fbb849a2eaeb5e0724768
Parent: fdd8feb60e7a7757aaa12d9df357cadeb1c31044
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Nov 23 13:18:07 2022 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Nov 25 15:55:56 2022 +0100
configure: update
---
configure | 111 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++---
1 file changed, 107 insertions(+), 4 deletions(-)
diff --git a/configure b/configure
index ccd5a5938..718f281bc 100755
--- a/configure
+++ b/configure
@@ -850,6 +850,7 @@ CHMOD
CSCOPE_CMD
CFLOW_CMD
AR
+READELF
RANLIB
MKDIR_P
SET_MAKE
@@ -5162,11 +5163,11 @@ if test x$ac_prog_cxx_stdcxx = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5
printf %s "checking for $CXX option to enable C++11 features... " >&6; }
-if test ${ac_cv_prog_cxx_11+y}
+if test ${ac_cv_prog_cxx_cxx11+y}
then :
printf %s "(cached) " >&6
else $as_nop
- ac_cv_prog_cxx_11=no
+ ac_cv_prog_cxx_cxx11=no
ac_save_CXX=$CXX
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -5208,11 +5209,11 @@ if test x$ac_prog_cxx_stdcxx = xno
then :
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5
printf %s "checking for $CXX option to enable C++98 features... " >&6; }
-if test ${ac_cv_prog_cxx_98+y}
+if test ${ac_cv_prog_cxx_cxx98+y}
then :
printf %s "(cached) " >&6
else $as_nop
- ac_cv_prog_cxx_98=no
+ ac_cv_prog_cxx_cxx98=no
ac_save_CXX=$CXX
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
@@ -5874,6 +5875,108 @@ else
RANLIB="$ac_cv_prog_RANLIB"
fi
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}readelf", so it can be a program name with args.
+set dummy ${ac_tool_prefix}readelf; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_READELF+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ if test -n "$READELF"; then
+ ac_cv_prog_READELF="$READELF" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+ ac_cv_prog_READELF="${ac_tool_prefix}readelf"
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+READELF=$ac_cv_prog_READELF
+if test -n "$READELF"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $READELF" >&5
+printf "%s\n" "$READELF" >&6; }
+else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_READELF"; then
+ ac_ct_READELF=$READELF
+ # Extract the first word of "readelf", so it can be a program name with args.
+set dummy readelf; ac_word=$2
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+printf %s "checking for $ac_word... " >&6; }
+if test ${ac_cv_prog_ac_ct_READELF+y}
+then :
+ printf %s "(cached) " >&6
+else $as_nop
+ if test -n "$ac_ct_READELF"; then
+ ac_cv_prog_ac_ct_READELF="$ac_ct_READELF" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ case $as_dir in #(((
+ '') as_dir=./ ;;
+ */) ;;
+ *) as_dir=$as_dir/ ;;
+ esac
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_READELF="readelf"
+ printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_READELF=$ac_cv_prog_ac_ct_READELF
+if test -n "$ac_ct_READELF"; then
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_ct_READELF" >&5
+printf "%s\n" "$ac_ct_READELF" >&6; }
+else
+ { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
+printf "%s\n" "no" >&6; }
+fi
+
+ if test "x$ac_ct_READELF" = x; then
+ READELF=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+printf "%s\n" "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ READELF=$ac_ct_READELF
+ fi
+else
+ READELF="$ac_cv_prog_READELF"
+fi
+
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fdd8feb60e7a7757aaa12…
Commit: fdd8feb60e7a7757aaa12d9df357cadeb1c31044
Parent: 3dee7b7266f79aba12805dfbfcd770dac3171051
Author: Sam James <sam(a)gentoo.org>
AuthorDate: Sat Nov 19 17:51:09 2022 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Fri Nov 25 15:55:23 2022 +0100
lvmpolld: fix `strerror_r` check for musl
We can't assume that strerror_r returns char* just because _GNU_SOURCE is
defined. We already call the appropriate autoconf test, so let's use its
result (STRERROR_R_CHAR_P).
Note that in configure, _GNU_SOURCE is always set, but we add a defined
guard just in case for futureproofing.
Bug: https://bugs.gentoo.org/869404
---
daemons/lvmpolld/lvmpolld-core.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/daemons/lvmpolld/lvmpolld-core.c b/daemons/lvmpolld/lvmpolld-core.c
index 47c9376b4..a75f71e2f 100644
--- a/daemons/lvmpolld/lvmpolld-core.c
+++ b/daemons/lvmpolld/lvmpolld-core.c
@@ -52,7 +52,7 @@ static pthread_key_t key;
static const char *_strerror_r(int errnum, struct lvmpolld_thread_data *data)
{
-#ifdef _GNU_SOURCE
+#if defined(_GNU_SOURCE) && defined(STRERROR_R_CHAR_P)
return strerror_r(errnum, data->buf, sizeof(data->buf)); /* never returns NULL */
#elif (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600)
return strerror_r(errnum, data->buf, sizeof(data->buf)) ? "" : data->buf;