master - cleanup: avoid unneeded check
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=08e838f488415ce6c7d...
Commit: 08e838f488415ce6c7df594327c383cdc7c2dcd7
Parent: af5f29c7e2f07005462d505c57a2f1440c9d50a3
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Sep 26 19:32:52 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 29 10:43:56 2020 +0200
cleanup: avoid unneeded check
Since creation of thin snapshot already makes sure,
the message list is empty, there is no need to check
this again.
---
lib/metadata/lv_manip.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index ce532ab92..793a86d1f 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -8482,8 +8482,7 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
stack;
goto revert_new_lv;
}
- }
- if (!dm_list_empty(&first_seg(pool_lv)->thin_messages)) {
+ } else if (!dm_list_empty(&first_seg(pool_lv)->thin_messages)) {
/* Send message so that table preload knows new thin */
if (!lv_is_active(pool_lv)) {
/* Avoid multiple thin-pool activations in this case */
3 years, 6 months
master - activation: move locking of critical section
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=af5f29c7e2f07005462...
Commit: af5f29c7e2f07005462d505c57a2f1440c9d50a3
Parent: 3ed11170da87089bbfb263c84b25b53159ae1558
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Sat Sep 26 14:56:44 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 29 10:43:56 2020 +0200
activation: move locking of critical section
Move begining of 'suspending' critical section closer to _lv_suspend_lv()
for better correctness of error paths.
---
lib/activate/activate.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/lib/activate/activate.c b/lib/activate/activate.c
index a9a01a8bc..2e8f0e467 100644
--- a/lib/activate/activate.c
+++ b/lib/activate/activate.c
@@ -2197,8 +2197,6 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
if (laopts->origin_only && lv_is_thin_volume(lv) && lv_is_thin_volume(lv_pre))
lockfs = 1;
- critical_section_inc(cmd, "suspending");
-
if (!lv_is_locked(lv) && lv_is_locked(lv_pre) &&
(pvmove_lv = find_pvmove_lv_in_lv(lv_pre))) {
/*
@@ -2240,16 +2238,23 @@ static int _lv_suspend(struct cmd_context *cmd, const char *lvid_s,
}
dm_list_add(&suspend_lvs, &lvl->list);
}
+
+ critical_section_inc(cmd, "suspending");
+
dm_list_iterate_items(lvl, &suspend_lvs)
if (!_lv_suspend_lv(lvl->lv, laopts, lockfs, 1)) {
critical_section_dec(cmd, "failed suspend");
goto_out; /* FIXME: resume on recovery path? */
}
- } else /* Standard suspend */
+
+ } else { /* Standard suspend */
+ critical_section_inc(cmd, "suspending");
+
if (!_lv_suspend_lv(lv, laopts, lockfs, flush_required)) {
critical_section_dec(cmd, "failed suspend");
goto_out;
}
+ }
r = 1;
out:
3 years, 6 months
master - configure: update help
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=3ed11170da87089bbfb...
Commit: 3ed11170da87089bbfb263c84b25b53159ae1558
Parent: 655342427da621174f04506fb7002f54af832e07
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Mon Sep 28 18:51:32 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 29 10:43:56 2020 +0200
configure: update help
Help shows new defaults.
---
configure | 10 +++++-----
configure.ac | 10 +++++-----
2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/configure b/configure
index d39ce1b98..c125aade1 100755
--- a/configure
+++ b/configure
@@ -1722,16 +1722,16 @@ Optional Packages:
cache_restore tool: [autodetect]
--with-vdo=TYPE vdo support: internal/none [internal]
--with-vdo-format=PATH vdoformat tool: [autodetect]
- --with-writecache=TYPE writecache support: internal/none [none]
- --with-integrity=TYPE integrity support: internal/none [none]
+ --with-writecache=TYPE writecache support: internal/none [internal]
+ --with-integrity=TYPE integrity support: internal/none [internal]
--with-ocfdir=DIR install OCF files in
[PREFIX/lib/ocf/resource.d/lvm2]
--with-default-pid-dir=PID_DIR
- Default directory to keep PID files in. [autodetect]
+ default directory to keep PID files in [autodetect]
--with-default-dm-run-dir=DM_RUN_DIR
- Default DM run directory. [autodetect]
+ default DM run directory [autodetect]
--with-default-run-dir=RUN_DIR
- Default LVM run directory. [autodetect_run_dir/lvm]
+ default LVM run directory [autodetect_run_dir/lvm]
--with-cmirrord-pidfile=PATH
cmirrord pidfile [PID_DIR/cmirrord.pid]
--with-optimisation=OPT C optimisation flag [OPT=-O2]
diff --git a/configure.ac b/configure.ac
index 3b06e472b..148bde426 100644
--- a/configure.ac
+++ b/configure.ac
@@ -654,7 +654,7 @@ dnl -- writecache inclusion type
AC_MSG_CHECKING(whether to include writecache)
AC_ARG_WITH(writecache,
AC_HELP_STRING([--with-writecache=TYPE],
- [writecache support: internal/none [none]]),
+ [writecache support: internal/none [internal]]),
WRITECACHE=$withval, WRITECACHE="internal")
AC_MSG_RESULT($WRITECACHE)
@@ -672,7 +672,7 @@ dnl -- integrity inclusion type
AC_MSG_CHECKING(whether to include integrity)
AC_ARG_WITH(integrity,
AC_HELP_STRING([--with-integrity=TYPE],
- [integrity support: internal/none [none]]),
+ [integrity support: internal/none [internal]]),
INTEGRITY=$withval, INTEGRITY="internal")
AC_MSG_RESULT($INTEGRITY)
@@ -740,7 +740,7 @@ dnl -- Set up pidfile and run directory
AH_TEMPLATE(DEFAULT_PID_DIR)
AC_ARG_WITH(default-pid-dir,
AC_HELP_STRING([--with-default-pid-dir=PID_DIR],
- [Default directory to keep PID files in. [autodetect]]),
+ [default directory to keep PID files in [autodetect]]),
DEFAULT_PID_DIR="$withval", DEFAULT_PID_DIR=$RUN_DIR)
AC_DEFINE_UNQUOTED(DEFAULT_PID_DIR, ["$DEFAULT_PID_DIR"],
[Default directory to keep PID files in.])
@@ -748,7 +748,7 @@ AC_DEFINE_UNQUOTED(DEFAULT_PID_DIR, ["$DEFAULT_PID_DIR"],
AH_TEMPLATE(DEFAULT_DM_RUN_DIR, [Name of default DM run directory.])
AC_ARG_WITH(default-dm-run-dir,
AC_HELP_STRING([--with-default-dm-run-dir=DM_RUN_DIR],
- [ Default DM run directory. [autodetect]]),
+ [default DM run directory [autodetect]]),
DEFAULT_DM_RUN_DIR="$withval", DEFAULT_DM_RUN_DIR=$RUN_DIR)
AC_DEFINE_UNQUOTED(DEFAULT_DM_RUN_DIR, ["$DEFAULT_DM_RUN_DIR"],
[Default DM run directory.])
@@ -756,7 +756,7 @@ AC_DEFINE_UNQUOTED(DEFAULT_DM_RUN_DIR, ["$DEFAULT_DM_RUN_DIR"],
AH_TEMPLATE(DEFAULT_RUN_DIR, [Name of default LVM run directory.])
AC_ARG_WITH(default-run-dir,
AC_HELP_STRING([--with-default-run-dir=RUN_DIR],
- [Default LVM run directory. [autodetect_run_dir/lvm]]),
+ [default LVM run directory [autodetect_run_dir/lvm]]),
DEFAULT_RUN_DIR="$withval", DEFAULT_RUN_DIR="$RUN_DIR/lvm")
AC_DEFINE_UNQUOTED(DEFAULT_RUN_DIR, ["$DEFAULT_RUN_DIR"],
[Default LVM run directory.])
3 years, 6 months
master - configure: editline updates
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=655342427da621174f0...
Commit: 655342427da621174f04506fb7002f54af832e07
Parent: 168e2ffbcd8c8cf20711be36059bfcf999a95012
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Sep 29 10:15:45 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 29 10:43:45 2020 +0200
configure: editline updates
Update configure file.
---
WHATS_NEW | 1 +
configure | 123 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
2 files changed, 123 insertions(+), 1 deletion(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index d50ba762a..a8639ff65 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.03.11 -
==================================
+ Add configure --enable-editline support as an alternative to readline.
Enhance reporting and error handling when creating thin volumes.
Enable vgsplit for VDO volumes.
Lvextend of vdo pool volumes ensure at least 1 new VDO slab is added.
diff --git a/configure b/configure
index f7b681cad..d39ce1b98 100755
--- a/configure
+++ b/configure
@@ -753,6 +753,8 @@ BUILD_CMIRRORD
BLKID_PC
MODPROBE_CMD
MSGFMT
+EDITLINE_LIBS
+EDITLINE_CFLAGS
PYTHON3_CONFIG
pkgpyexecdir
pyexecdir
@@ -920,6 +922,7 @@ with_vdo_format
with_writecache
with_integrity
enable_readline
+enable_editline
enable_realtime
enable_ocf
with_ocfdir
@@ -1015,7 +1018,9 @@ SYSTEMD_CFLAGS
SYSTEMD_LIBS
UDEV_CFLAGS
UDEV_LIBS
-PYTHON'
+PYTHON
+EDITLINE_CFLAGS
+EDITLINE_LIBS'
# Initialize some variables set by options.
@@ -1638,6 +1643,7 @@ Optional Features:
--disable-cache_check_needs_check
required if cache_check version is < 0.5
--disable-readline disable readline support
+ --enable-editline enable editline support
--disable-realtime disable realtime clock support
--enable-ocf enable Open Cluster Framework (OCF) compliant
resource agents
@@ -1816,6 +1822,10 @@ Some influential environment variables:
UDEV_CFLAGS C compiler flags for UDEV, overriding pkg-config
UDEV_LIBS linker flags for UDEV, overriding pkg-config
PYTHON the Python interpreter
+ EDITLINE_CFLAGS
+ C compiler flags for EDITLINE, overriding pkg-config
+ EDITLINE_LIBS
+ linker flags for EDITLINE, overriding pkg-config
Use these variables to override the choices made by `configure' or to help
it to find libraries and programs with nonstandard names/locations.
@@ -9797,6 +9807,15 @@ else
fi
+################################################################################
+# Check whether --enable-editline was given.
+if test "${enable_editline+set}" = set; then :
+ enableval=$enable_editline; EDITLINE=$enableval
+else
+ EDITLINE=no
+fi
+
+
################################################################################
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable realtime support" >&5
$as_echo_n "checking whether to enable realtime support... " >&6; }
@@ -12808,6 +12827,86 @@ fi
done
+################################################################################
+if test "$EDITLINE" == yes; then
+
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for EDITLINE" >&5
+$as_echo_n "checking for EDITLINE... " >&6; }
+
+if test -n "$EDITLINE_CFLAGS"; then
+ pkg_cv_EDITLINE_CFLAGS="$EDITLINE_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libedit\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libedit") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_EDITLINE_CFLAGS=`$PKG_CONFIG --cflags "libedit" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$EDITLINE_LIBS"; then
+ pkg_cv_EDITLINE_LIBS="$EDITLINE_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libedit\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "libedit") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_EDITLINE_LIBS=`$PKG_CONFIG --libs "libedit" 2>/dev/null`
+ test "x$?" != "x0" && pkg_failed=yes
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
+fi
+ if test $_pkg_short_errors_supported = yes; then
+ EDITLINE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libedit" 2>&1`
+ else
+ EDITLINE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libedit" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$EDITLINE_PKG_ERRORS" >&5
+
+ as_fn_error $? "libedit could not be found which is required for the --enable-readline option." "$LINENO" 5
+
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ as_fn_error $? "libedit could not be found which is required for the --enable-readline option." "$LINENO" 5
+
+else
+ EDITLINE_CFLAGS=$pkg_cv_EDITLINE_CFLAGS
+ EDITLINE_LIBS=$pkg_cv_EDITLINE_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+
+$as_echo "#define EDITLINE_SUPPORT 1" >>confdefs.h
+
+fi
+fi
+
################################################################################
if test "$READLINE" != no; then
lvm_saved_libs=$LIBS
@@ -13246,6 +13345,28 @@ $as_echo_n "checking whether to enable readline... " >&6; }
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE" >&5
$as_echo "$READLINE" >&6; }
+if test "$EDITLINE" = yes; then
+ for ac_header in editline/readline.h editline/history.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+else
+ hard_bailout
+fi
+
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable editline" >&5
+$as_echo_n "checking whether to enable editline... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $EDITLINE" >&5
+$as_echo "$EDITLINE" >&6; }
+
if test "$BUILD_CMIRRORD" = yes; then
for ac_func in atexit
do :
3 years, 6 months
master - lvm: add readline alternative editline
by Zdenek Kabelac
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=168e2ffbcd8c8cf2071...
Commit: 168e2ffbcd8c8cf20711be36059bfcf999a95012
Parent: fb96e9ab217641ec3a967d9aa2be01fc936ee038
Author: Bastian Germann <bastiangermann(a)fishpost.de>
AuthorDate: Sat Sep 26 21:32:55 2020 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Tue Sep 29 10:13:24 2020 +0200
lvm: add readline alternative editline
LVM2 is distributed under GPLv2 only. The readline library changed its
license long ago to GPLv3. Given that those licenses are incompatible
and you follow the FSF in their interpretation that dynamically linking
creates a derivative work, distributing LVM2 linked against a current
readline version might be legally problematic.
Add support for the BSD licensed editline library as an alternative for
readline.
Link: https://thrysoee.dk/editline
---
configure.ac | 23 +++++++++++++++++++++++
include/configure.h.in | 9 +++++++++
lib/mm/memlock.c | 1 +
libdm/make.tmpl.in | 1 +
make.tmpl.in | 1 +
tools/Makefile.in | 2 +-
tools/lvm.c | 21 +++++++++++++--------
tools/lvmcmdline.c | 2 +-
8 files changed, 50 insertions(+), 10 deletions(-)
diff --git a/configure.ac b/configure.ac
index c2a72abf2..3b06e472b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -691,6 +691,12 @@ AC_ARG_ENABLE([readline],
AC_HELP_STRING([--disable-readline], [disable readline support]),
READLINE=$enableval, READLINE=maybe)
+################################################################################
+dnl -- Disable editline
+AC_ARG_ENABLE([editline],
+ AC_HELP_STRING([--enable-editline], [enable editline support]),
+ EDITLINE=$enableval, EDITLINE=no)
+
################################################################################
dnl -- Disable realtime clock support
AC_MSG_CHECKING(whether to enable realtime support)
@@ -1378,6 +1384,16 @@ AC_IF_YES(ac_cv_stat_st_ctim,
dnl -- Check for getopt
AC_CHECK_HEADERS(getopt.h, AC_DEFINE([HAVE_GETOPTLONG], 1, [Define to 1 if getopt_long is available.]))
+################################################################################
+dnl -- Check for editline
+if test "$EDITLINE" == yes; then
+ PKG_CHECK_MODULES([EDITLINE], [libedit], [
+ AC_DEFINE([EDITLINE_SUPPORT], 1,
+ [Define to 1 to include the LVM editline shell.])], AC_MSG_ERROR(
+[libedit could not be found which is required for the --enable-readline option.])
+ )
+fi
+
################################################################################
dnl -- Check for readline (Shamelessly copied from parted 1.4.17)
if test "$READLINE" != no; then
@@ -1510,6 +1526,12 @@ fi
AC_MSG_CHECKING(whether to enable readline)
AC_MSG_RESULT($READLINE)
+if test "$EDITLINE" = yes; then
+ AC_CHECK_HEADERS(editline/readline.h editline/history.h,,hard_bailout)
+fi
+AC_MSG_CHECKING(whether to enable editline)
+AC_MSG_RESULT($EDITLINE)
+
if test "$BUILD_CMIRRORD" = yes; then
AC_CHECK_FUNCS(atexit,,hard_bailout)
fi
@@ -1765,6 +1787,7 @@ AC_SUBST(QUORUM_CFLAGS)
AC_SUBST(QUORUM_LIBS)
AC_SUBST(RT_LIBS)
AC_SUBST(READLINE_LIBS)
+AC_SUBST(EDITLINE_LIBS)
AC_SUBST(REPLICATORS)
AC_SUBST(SACKPT_CFLAGS)
AC_SUBST(SACKPT_LIBS)
diff --git a/include/configure.h.in b/include/configure.h.in
index 540cee7cf..46d5aef20 100644
--- a/include/configure.h.in
+++ b/include/configure.h.in
@@ -126,6 +126,9 @@
/* Library version */
#undef DM_LIB_VERSION
+/* Define to 1 to include the LVM editline shell. */
+#undef EDITLINE_SUPPORT
+
/* Path to fsadm binary. */
#undef FSADM_PATH
@@ -176,6 +179,12 @@
/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
#undef HAVE_DOPRNT
+/* Define to 1 if you have the <editline/history.h> header file. */
+#undef HAVE_EDITLINE_HISTORY_H
+
+/* Define to 1 if you have the <editline/readline.h> header file. */
+#undef HAVE_EDITLINE_READLINE_H
+
/* Define to 1 if you have the <errno.h> header file. */
#undef HAVE_ERRNO_H
diff --git a/lib/mm/memlock.c b/lib/mm/memlock.c
index b06bbc82c..883795d28 100644
--- a/lib/mm/memlock.c
+++ b/lib/mm/memlock.c
@@ -122,6 +122,7 @@ static const char * const _blacklist_maps[] = {
"/libpcre.so.", /* not using pcre during mlock (selinux) */
"/libpcre2-", /* not using pcre during mlock (selinux) */
"/libreadline.so.", /* not using readline during mlock */
+ "/libedit.so.", /* not using editline during mlock */
"/libresolv-", /* not using during mlock (udev) */
"/libselinux.so.", /* not using selinux during mlock */
"/libsepol.so.", /* not using sepol during mlock */
diff --git a/libdm/make.tmpl.in b/libdm/make.tmpl.in
index 9041da52e..aaf8a5e77 100644
--- a/libdm/make.tmpl.in
+++ b/libdm/make.tmpl.in
@@ -71,6 +71,7 @@ RT_LIBS = @RT_LIBS@
M_LIBS = @M_LIBS@
PTHREAD_LIBS = @PTHREAD_LIBS@
READLINE_LIBS = @READLINE_LIBS@
+EDITLINE_LIBS = @EDITLINE_LIBS@
SELINUX_LIBS = @SELINUX_LIBS@
UDEV_CFLAGS = @UDEV_CFLAGS@
UDEV_LIBS = @UDEV_LIBS@
diff --git a/make.tmpl.in b/make.tmpl.in
index 8a2081897..4549746ab 100644
--- a/make.tmpl.in
+++ b/make.tmpl.in
@@ -77,6 +77,7 @@ RT_LIBS = @RT_LIBS@
M_LIBS = @M_LIBS@
PTHREAD_LIBS = @PTHREAD_LIBS@
READLINE_LIBS = @READLINE_LIBS@
+EDITLINE_LIBS = @EDITLINE_LIBS@
SELINUX_LIBS = @SELINUX_LIBS@
UDEV_CFLAGS = @UDEV_CFLAGS@
UDEV_LIBS = @UDEV_LIBS@
diff --git a/tools/Makefile.in b/tools/Makefile.in
index 2620daa17..11160e655 100644
--- a/tools/Makefile.in
+++ b/tools/Makefile.in
@@ -122,7 +122,7 @@ CFLAGS_lvm.o += $(EXTRA_EXEC_CFLAGS)
lvm: $(OBJECTS) lvm.o $(LVMINTERNAL_LIBS)
@echo " [CC] $@"
$(Q) $(CC) $(CFLAGS) $(LDFLAGS) $(EXTRA_EXEC_LDFLAGS) $(ELDFLAGS) -o $@ $+ \
- $(DMEVENT_LIBS) $(READLINE_LIBS) $(LVMLIBS)
+ $(DMEVENT_LIBS) $(READLINE_LIBS) $(EDITLINE_LIBS) $(LVMLIBS)
DEFS_man-generator.o += -DMAN_PAGE_GENERATOR
diff --git a/tools/lvm.c b/tools/lvm.c
index 4bfa6f5c2..79b1210af 100644
--- a/tools/lvm.c
+++ b/tools/lvm.c
@@ -22,13 +22,18 @@ int main(int argc, char **argv)
return lvm2_main(argc, argv);
}
-#ifdef READLINE_SUPPORT
-
-# include <readline/readline.h>
-# include <readline/history.h>
-# ifndef HAVE_RL_COMPLETION_MATCHES
-# define rl_completion_matches(a, b) completion_matches((char *)a, b)
-# define rl_completion_func_t CPPFunction
+#if defined(READLINE_SUPPORT) || defined(EDITLINE_SUPPORT)
+
+# ifdef READLINE_SUPPORT
+# include <readline/readline.h>
+# include <readline/history.h>
+# ifndef HAVE_RL_COMPLETION_MATCHES
+# define rl_completion_matches(a, b) completion_matches((char *)a, b)
+# define rl_completion_func_t CPPFunction
+# endif
+# elif defined(EDITLINE_SUPPORT)
+# include <editline/readline.h>
+# include <editline/history.h>
# endif
static struct cmdline_context *_cmdline;
@@ -348,4 +353,4 @@ int lvm_shell(struct cmd_context *cmd, struct cmdline_context *cmdline)
return 0;
}
-#endif /* READLINE_SUPPORT */
+#endif /* READLINE_SUPPORT || EDITLINE_SUPPORT */
diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
index 8dd38e51d..e8d732878 100644
--- a/tools/lvmcmdline.c
+++ b/tools/lvmcmdline.c
@@ -3646,7 +3646,7 @@ int lvm2_main(int argc, char **argv)
}
if (run_shell) {
-#ifdef READLINE_SUPPORT
+#if defined(READLINE_SUPPORT) || defined(EDITLINE_SUPPORT)
_nonroot_warning();
if (!_prepare_profiles(cmd)) {
ret = ECMD_FAILED;
3 years, 6 months
master - tests: add case for metadata checksum differences
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=fb96e9ab217641ec3a9...
Commit: fb96e9ab217641ec3a967d9aa2be01fc936ee038
Parent: df6f16c081ffca48f2c812e539851995b7563b68
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Mon Sep 28 13:21:44 2020 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Sep 28 13:25:57 2020 -0500
tests: add case for metadata checksum differences
Cover the case where two copies of metadata have the
same seqno but different checksums. Also elaborate
on an existing fixme in the code for this case, since
we should be doing something better for this case.
This had been uncovering an issue with reopening
fds in readwrite mode.
---
lib/cache/lvmcache.c | 3 +++
test/shell/metadata-old.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++
test/shell/pvck-repair.sh | 2 --
3 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index d8df4c796..9716eccaf 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -1663,6 +1663,9 @@ int lvmcache_update_vgname_and_id(struct cmd_context *cmd, struct lvmcache_info
* second updated to seqno 4, first comes back and second goes
* missing, first updated to seqno 4, second comes back, now
* both are present with same seqno but different checksums.
+ * FIXME: we should check if the majority of mda copies have one
+ * checksum and if so use that copy of metadata, but if there's
+ * not a majority, don't allow the VG to be modified/activated.
*/
if ((vginfo->mda_size != vgsummary->mda_size) || (vginfo->mda_checksum != vgsummary->mda_checksum)) {
diff --git a/test/shell/metadata-old.sh b/test/shell/metadata-old.sh
index 53133bc6a..a193ebf31 100644
--- a/test/shell/metadata-old.sh
+++ b/test/shell/metadata-old.sh
@@ -175,3 +175,48 @@ lvs $vg/$lv4
vgchange -an $vg
vgremove -ff $vg
+
+# Test when the metadata on two PVs have the same seqno
+# but different checksums.
+
+dd if=/dev/zero of="$dev1" || true
+dd if=/dev/zero of="$dev2" || true
+
+pvcreate "$dev1"
+pvcreate "$dev2"
+
+vgcreate $SHARED $vg "$dev1" "$dev2"
+
+lvcreate -n $lv1 -l1 -an $vg
+
+pvck --dump metadata -f meta "$dev2"
+
+# change an unimportant character so the metadata is effectively
+# the same in content but will have a different checksum
+sed 's/Linux/linux/' meta > meta2
+
+# write out the changed metadata
+pvck --repair -y -f meta2 "$dev2"
+
+# the vg can still be used but will produce warnings
+# the mda on one pv is updated, but not the other,
+# which changes the error from a checksum inconsistency
+# into a seqno inconsistency.
+lvs $vg 2>&1 | tee out
+grep WARNING out
+grep $lv1 out
+lvcreate -n $lv2 -l1 -an $vg 2>&1 |tee out
+grep WARNING out
+lvs $vg 2>&1 | tee out
+grep WARNING out
+grep $lv1 out
+grep $lv2 out
+
+# correct the senqo inconsistency
+vgck --updatemetadata $vg
+lvs $vg 2>&1 | tee out
+not grep WARNING out
+grep $lv1 out
+grep $lv2 out
+
+vgremove -ff $vg
diff --git a/test/shell/pvck-repair.sh b/test/shell/pvck-repair.sh
index b6038944a..d48e25198 100644
--- a/test/shell/pvck-repair.sh
+++ b/test/shell/pvck-repair.sh
@@ -399,8 +399,6 @@ lvcreate -l1 -an $vg
# One PV, one mda, pv_header zeroed, unmatching dev name requires specified uuid
_clear_devs "$dev1" "$dev2"
vgcreate $vg "$dev1"
-#!!! FIXME: with this hits INTERNAL_ERROR
-#!!! vgcreate $vg "$dev1" "$dev2"
pvck --dump headers "$dev1" || true
UUID1=`pvck --dump headers "$dev1" | grep pv_header.pv_uuid | awk '{print $2}'`
echo $UUID1
3 years, 6 months
master - lvpoll: don't use hints
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=df6f16c081ffca48f2c...
Commit: df6f16c081ffca48f2c812e539851995b7563b68
Parent: da14cf68cb62e1bf2e9718358158dde48a1acd20
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Sep 25 12:29:10 2020 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Sep 28 13:25:57 2020 -0500
lvpoll: don't use hints
There's a bug when lvpoll attempts to write new hints,
related to the fact that lvpoll does not follow the same
scanning process as standard commands.
Fix by disabling the use of hints in lvpoll. We may want
to renable hints in lvpoll in a way that they can be used,
if valid, but not updated if they don't exist or are invalid.
---
tools/commands.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/commands.h b/tools/commands.h
index c1670ae66..ae1bf3934 100644
--- a/tools/commands.h
+++ b/tools/commands.h
@@ -137,7 +137,7 @@ xx(pvmove,
xx(lvpoll,
"Continue already initiated poll operation on a logical volume",
- ALLOW_HINTS)
+ 0)
xx(pvremove,
"Remove LVM label(s) from physical volume(s)",
3 years, 6 months
master - scanning: keep open an lvm device with scanning problem
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=da14cf68cb62e1bf2e9...
Commit: da14cf68cb62e1bf2e9718358158dde48a1acd20
Parent: 890c7ef451809a498978651a1802f65606a7c16b
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Sep 25 11:52:55 2020 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Sep 28 13:25:57 2020 -0500
scanning: keep open an lvm device with scanning problem
The command may want to update it.
---
lib/label/label.c | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/lib/label/label.c b/lib/label/label.c
index 27d06d783..de01e4532 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -678,7 +678,6 @@ static int _scan_list(struct cmd_context *cmd, struct dev_filter *f,
int scan_failed_count = 0;
int rem_prefetches;
int submit_count;
- int scan_failed;
int is_lvm_device;
int ret;
@@ -726,12 +725,10 @@ static int _scan_list(struct cmd_context *cmd, struct dev_filter *f,
dm_list_iterate_items_safe(devl, devl2, &wait_devs) {
bb = NULL;
- scan_failed = 0;
is_lvm_device = 0;
if (!bcache_get(scan_bcache, devl->dev->bcache_di, 0, 0, &bb)) {
log_debug_devs("Scan failed to read %s.", dev_name(devl->dev));
- scan_failed = 1;
scan_read_errors++;
scan_failed_count++;
lvmcache_del_dev(devl->dev);
@@ -746,7 +743,6 @@ static int _scan_list(struct cmd_context *cmd, struct dev_filter *f,
if (!ret && is_lvm_device) {
log_debug_devs("Scan failed to process %s", dev_name(devl->dev));
- scan_failed = 1;
scan_process_errors++;
scan_failed_count++;
}
@@ -761,7 +757,7 @@ static int _scan_list(struct cmd_context *cmd, struct dev_filter *f,
* read the block, or the device does not belong to lvm, then
* drop it from bcache.
*/
- if (scan_failed || !is_lvm_device) {
+ if (!is_lvm_device) {
_invalidate_di(scan_bcache, devl->dev->bcache_di);
_scan_dev_close(devl->dev);
}
3 years, 6 months
master - devices: fix reopen for unopened device
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=890c7ef451809a49897...
Commit: 890c7ef451809a498978651a1802f65606a7c16b
Parent: 8952dcbff0c1ca9bfaa2f8fe8b6da78a10319e6b
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Fri Sep 25 11:59:49 2020 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Mon Sep 28 13:25:57 2020 -0500
devices: fix reopen for unopened device
If there's a request to reopen rw a device that's not
open, then just call the normal open function.
---
lib/label/label.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/label/label.c b/lib/label/label.c
index 0090fd0a5..27d06d783 100644
--- a/lib/label/label.c
+++ b/lib/label/label.c
@@ -1460,7 +1460,8 @@ int label_scan_reopen_rw(struct device *dev)
dev_name(dev), dev->bcache_fd, dev->bcache_di);
return 0;
}
- goto do_open;
+ dev->flags |= DEV_BCACHE_WRITE;
+ return _scan_dev_open(dev);
}
if ((dev->flags & DEV_BCACHE_WRITE))
@@ -1477,7 +1478,6 @@ int label_scan_reopen_rw(struct device *dev)
return 0;
}
- do_open:
flags |= O_DIRECT;
flags |= O_NOATIME;
flags |= O_RDWR;
3 years, 6 months
master - Revert "lvconvert: display warning if raid1 LV image count does not change"
by Heinz Mauelshagen
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=8952dcbff0c1ca9bfaa...
Commit: 8952dcbff0c1ca9bfaa2f8fe8b6da78a10319e6b
Parent: bbc164991afc5d28bcf12bd4709c4137c913e412
Author: Heinz Mauelshagen <heinzm(a)redhat.com>
AuthorDate: Mon Sep 28 17:14:03 2020 +0200
Committer: Heinz Mauelshagen <heinzm(a)redhat.com>
CommitterDate: Mon Sep 28 17:14:03 2020 +0200
Revert "lvconvert: display warning if raid1 LV image count does not change"
This reverts superfluous commit 3c9177fdc0b8f94c0ae335790a485477901b685d as
_lv_raid_change_image_count() already checks for non-changed image count.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1872130
---
lib/metadata/raid_manip.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c
index 1ff2a0c85..3b3e1d373 100644
--- a/lib/metadata/raid_manip.c
+++ b/lib/metadata/raid_manip.c
@@ -3229,11 +3229,6 @@ int lv_raid_change_image_count(struct logical_volume *lv, int yes, uint32_t new_
const char *level = seg->area_count == 1 ? "raid1 with " : "";
const char *resil = new_count < seg->area_count ? "reducing" : "enhancing";
- if (new_count == seg->area_count) {
- log_warn("Type %s LV %s already has %u images.", lvseg_name(seg), display_lvname(lv), new_count);
- return 1;
- }
-
/* LV must be active to perform raid conversion operations */
if (!lv_is_active(lv)) {
log_error("%s must be active to perform this operation.",
3 years, 6 months