mirror of
git://sourceware.org/git/lvm2.git
synced 2025-02-06 01:58:01 +03:00
Add lvmlockd
This commit is contained in:
parent
a32d5a4afc
commit
fe70b03de2
246
configure
vendored
246
configure
vendored
@ -636,6 +636,7 @@ kerneldir
|
||||
interface
|
||||
CMIRRORD_PIDFILE
|
||||
CLVMD_PIDFILE
|
||||
LVMLOCKD_PIDFILE
|
||||
LVMPOLLD_PIDFILE
|
||||
LVMETAD_PIDFILE
|
||||
DMEVENTD_PIDFILE
|
||||
@ -693,6 +694,7 @@ DMEVENTD_PATH
|
||||
DMEVENTD
|
||||
DL_LIBS
|
||||
DEVMAPPER
|
||||
DEFAULT_USE_LVMLOCKD
|
||||
DEFAULT_USE_LVMPOLLD
|
||||
DEFAULT_USE_LVMETAD
|
||||
DEFAULT_USE_BLKID_WIPING
|
||||
@ -722,6 +724,7 @@ CLDWHOLEARCHIVE
|
||||
CLDNOWHOLEARCHIVE
|
||||
CLDFLAGS
|
||||
CACHE
|
||||
BUILD_LVMLOCKD
|
||||
BUILD_LVMPOLLD
|
||||
BUILD_LVMETAD
|
||||
BUILD_DMEVENTD
|
||||
@ -740,6 +743,10 @@ SYSTEMD_LIBS
|
||||
SYSTEMD_CFLAGS
|
||||
BLKID_LIBS
|
||||
BLKID_CFLAGS
|
||||
LOCKD_DLM_LIBS
|
||||
LOCKD_DLM_CFLAGS
|
||||
LOCKD_SANLOCK_LIBS
|
||||
LOCKD_SANLOCK_CFLAGS
|
||||
VALGRIND_LIBS
|
||||
VALGRIND_CFLAGS
|
||||
CUNIT_LIBS
|
||||
@ -916,6 +923,9 @@ with_lvmetad_pidfile
|
||||
enable_lvmpolld
|
||||
enable_use_lvmpolld
|
||||
with_lvmpolld_pidfile
|
||||
enable_lvmlockd
|
||||
enable_use_lvmlockd
|
||||
with_lvmlockd_pidfile
|
||||
enable_blkid_wiping
|
||||
enable_udev_systemd_background_jobs
|
||||
enable_udev_sync
|
||||
@ -994,6 +1004,10 @@ CUNIT_CFLAGS
|
||||
CUNIT_LIBS
|
||||
VALGRIND_CFLAGS
|
||||
VALGRIND_LIBS
|
||||
LOCKD_SANLOCK_CFLAGS
|
||||
LOCKD_SANLOCK_LIBS
|
||||
LOCKD_DLM_CFLAGS
|
||||
LOCKD_DLM_LIBS
|
||||
BLKID_CFLAGS
|
||||
BLKID_LIBS
|
||||
SYSTEMD_CFLAGS
|
||||
@ -1632,6 +1646,8 @@ Optional Features:
|
||||
--disable-use-lvmetad disable usage of LVM Metadata Daemon
|
||||
--enable-lvmpolld enable the LVM Polling Daemon
|
||||
--disable-use-lvmpolld disable usage of LVM Poll Daemon
|
||||
--enable-lvmlockd enable the LVM lock daemon
|
||||
--disable-use-lvmlockd disable usage of LVM lock daemon
|
||||
--disable-blkid_wiping disable libblkid detection of signatures when wiping
|
||||
and use native code instead
|
||||
--disable-udev-systemd-background-jobs
|
||||
@ -1725,6 +1741,8 @@ Optional Packages:
|
||||
lvmetad pidfile [PID_DIR/lvmetad.pid]
|
||||
--with-lvmpolld-pidfile=PATH
|
||||
lvmpolld pidfile [PID_DIR/lvmpolld.pid]
|
||||
--with-lvmlockd-pidfile=PATH
|
||||
lvmlockd pidfile [PID_DIR/lvmlockd.pid]
|
||||
--with-localedir=DIR locale-dependent data [DATAROOTDIR/locale]
|
||||
--with-confdir=DIR configuration files in DIR [/etc]
|
||||
--with-staticdir=DIR static binaries in DIR [EPREFIX/sbin]
|
||||
@ -1809,6 +1827,14 @@ Some influential environment variables:
|
||||
C compiler flags for VALGRIND, overriding pkg-config
|
||||
VALGRIND_LIBS
|
||||
linker flags for VALGRIND, overriding pkg-config
|
||||
LOCKD_SANLOCK_CFLAGS
|
||||
C compiler flags for LOCKD_SANLOCK, overriding pkg-config
|
||||
LOCKD_SANLOCK_LIBS
|
||||
linker flags for LOCKD_SANLOCK, overriding pkg-config
|
||||
LOCKD_DLM_CFLAGS
|
||||
C compiler flags for LOCKD_DLM, overriding pkg-config
|
||||
LOCKD_DLM_LIBS
|
||||
linker flags for LOCKD_DLM, overriding pkg-config
|
||||
BLKID_CFLAGS
|
||||
C compiler flags for BLKID, overriding pkg-config
|
||||
BLKID_LIBS linker flags for BLKID, overriding pkg-config
|
||||
@ -3042,6 +3068,7 @@ case "$host_os" in
|
||||
DEVMAPPER=yes
|
||||
LVMETAD=no
|
||||
LVMPOLLD=no
|
||||
LVMLOCKD=no
|
||||
ODIRECT=yes
|
||||
DM_IOCTLS=yes
|
||||
SELINUX=yes
|
||||
@ -10966,6 +10993,207 @@ _ACEOF
|
||||
|
||||
|
||||
################################################################################
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build lvmlockd" >&5
|
||||
$as_echo_n "checking whether to build lvmlockd... " >&6; }
|
||||
# Check whether --enable-lvmlockd was given.
|
||||
if test "${enable_lvmlockd+set}" = set; then :
|
||||
enableval=$enable_lvmlockd; LVMLOCKD=$enableval
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $LVMLOCKD" >&5
|
||||
$as_echo "$LVMLOCKD" >&6; }
|
||||
|
||||
BUILD_LVMLOCKD=$LVMLOCKD
|
||||
|
||||
if test "$BUILD_LVMLOCKD" = yes; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking defaults for use_lvmlockd" >&5
|
||||
$as_echo_n "checking defaults for use_lvmlockd... " >&6; }
|
||||
# Check whether --enable-use_lvmlockd was given.
|
||||
if test "${enable_use_lvmlockd+set}" = set; then :
|
||||
enableval=$enable_use_lvmlockd; case ${enableval} in
|
||||
yes) DEFAULT_USE_LVMLOCKD=1 ;;
|
||||
*) DEFAULT_USE_LVMLOCKD=0 ;;
|
||||
esac
|
||||
else
|
||||
DEFAULT_USE_LVMLOCKD=1
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $DEFAULT_USE_LVMLOCKD" >&5
|
||||
$as_echo "$DEFAULT_USE_LVMLOCKD" >&6; }
|
||||
|
||||
$as_echo "#define LVMLOCKD_SUPPORT 1" >>confdefs.h
|
||||
|
||||
|
||||
|
||||
# Check whether --with-lvmlockd-pidfile was given.
|
||||
if test "${with_lvmlockd_pidfile+set}" = set; then :
|
||||
withval=$with_lvmlockd_pidfile; LVMLOCKD_PIDFILE=$withval
|
||||
else
|
||||
LVMLOCKD_PIDFILE="$DEFAULT_PID_DIR/lvmlockd.pid"
|
||||
fi
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define LVMLOCKD_PIDFILE "$LVMLOCKD_PIDFILE"
|
||||
_ACEOF
|
||||
|
||||
else
|
||||
DEFAULT_USE_LVMLOCKD=0
|
||||
fi
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define DEFAULT_USE_LVMLOCKD $DEFAULT_USE_LVMLOCKD
|
||||
_ACEOF
|
||||
|
||||
|
||||
################################################################################
|
||||
if test "$BUILD_LVMLOCKD" = yes; then
|
||||
|
||||
pkg_failed=no
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LOCKD_SANLOCK" >&5
|
||||
$as_echo_n "checking for LOCKD_SANLOCK... " >&6; }
|
||||
|
||||
if test -n "$LOCKD_SANLOCK_CFLAGS"; then
|
||||
pkg_cv_LOCKD_SANLOCK_CFLAGS="$LOCKD_SANLOCK_CFLAGS"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsanlock_client\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "libsanlock_client") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_LOCKD_SANLOCK_CFLAGS=`$PKG_CONFIG --cflags "libsanlock_client" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
if test -n "$LOCKD_SANLOCK_LIBS"; then
|
||||
pkg_cv_LOCKD_SANLOCK_LIBS="$LOCKD_SANLOCK_LIBS"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libsanlock_client\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "libsanlock_client") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_LOCKD_SANLOCK_LIBS=`$PKG_CONFIG --libs "libsanlock_client" 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
|
||||
LOCKD_SANLOCK_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libsanlock_client" 2>&1`
|
||||
else
|
||||
LOCKD_SANLOCK_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libsanlock_client" 2>&1`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$LOCKD_SANLOCK_PKG_ERRORS" >&5
|
||||
|
||||
$bailout
|
||||
elif test $pkg_failed = untried; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
$bailout
|
||||
else
|
||||
LOCKD_SANLOCK_CFLAGS=$pkg_cv_LOCKD_SANLOCK_CFLAGS
|
||||
LOCKD_SANLOCK_LIBS=$pkg_cv_LOCKD_SANLOCK_LIBS
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
HAVE_LOCKD_SANLOCK=yes
|
||||
fi
|
||||
|
||||
pkg_failed=no
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for LOCKD_DLM" >&5
|
||||
$as_echo_n "checking for LOCKD_DLM... " >&6; }
|
||||
|
||||
if test -n "$LOCKD_DLM_CFLAGS"; then
|
||||
pkg_cv_LOCKD_DLM_CFLAGS="$LOCKD_DLM_CFLAGS"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdlm\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "libdlm") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_LOCKD_DLM_CFLAGS=`$PKG_CONFIG --cflags "libdlm" 2>/dev/null`
|
||||
test "x$?" != "x0" && pkg_failed=yes
|
||||
else
|
||||
pkg_failed=yes
|
||||
fi
|
||||
else
|
||||
pkg_failed=untried
|
||||
fi
|
||||
if test -n "$LOCKD_DLM_LIBS"; then
|
||||
pkg_cv_LOCKD_DLM_LIBS="$LOCKD_DLM_LIBS"
|
||||
elif test -n "$PKG_CONFIG"; then
|
||||
if test -n "$PKG_CONFIG" && \
|
||||
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libdlm\""; } >&5
|
||||
($PKG_CONFIG --exists --print-errors "libdlm") 2>&5
|
||||
ac_status=$?
|
||||
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||||
test $ac_status = 0; }; then
|
||||
pkg_cv_LOCKD_DLM_LIBS=`$PKG_CONFIG --libs "libdlm" 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
|
||||
LOCKD_DLM_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libdlm" 2>&1`
|
||||
else
|
||||
LOCKD_DLM_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libdlm" 2>&1`
|
||||
fi
|
||||
# Put the nasty error message in config.log where it belongs
|
||||
echo "$LOCKD_DLM_PKG_ERRORS" >&5
|
||||
|
||||
$bailout
|
||||
elif test $pkg_failed = untried; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||||
$as_echo "no" >&6; }
|
||||
$bailout
|
||||
else
|
||||
LOCKD_DLM_CFLAGS=$pkg_cv_LOCKD_DLM_CFLAGS
|
||||
LOCKD_DLM_LIBS=$pkg_cv_LOCKD_DLM_LIBS
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||||
$as_echo "yes" >&6; }
|
||||
HAVE_LOCKD_DLM=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable libblkid detection of signatures when wiping" >&5
|
||||
$as_echo_n "checking whether to enable libblkid detection of signatures when wiping... " >&6; }
|
||||
# Check whether --enable-blkid_wiping was given.
|
||||
@ -13282,12 +13510,15 @@ LVM_LIBAPI=`echo "$VER" | $AWK -F '[()]' '{print $2}'`
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
################################################################################
|
||||
ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/lvmetad/Makefile daemons/lvmpolld/Makefile conf/Makefile conf/example.conf conf/lvmlocal.conf conf/command_profile_template.profile conf/metadata_profile_template.profile include/.symlinks include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/replicator/Makefile lib/misc/lvm-version.h lib/raid/Makefile lib/snapshot/Makefile lib/thin/Makefile lib/cache_segtype/Makefile libdaemon/Makefile libdaemon/client/Makefile libdaemon/server/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile python/Makefile python/setup.py scripts/blkdeactivate.sh scripts/blk_availability_init_red_hat scripts/blk_availability_systemd_red_hat.service scripts/clvmd_init_red_hat scripts/cmirrord_init_red_hat scripts/dm_event_systemd_red_hat.service scripts/dm_event_systemd_red_hat.socket scripts/lvm2_cluster_activation_red_hat.sh scripts/lvm2_cluster_activation_systemd_red_hat.service scripts/lvm2_clvmd_systemd_red_hat.service scripts/lvm2_cmirrord_systemd_red_hat.service scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_lvmetad_systemd_red_hat.socket scripts/lvm2_lvmpolld_init_red_hat scripts/lvm2_lvmpolld_systemd_red_hat.service scripts/lvm2_lvmpolld_systemd_red_hat.socket scripts/lvm2_monitoring_init_red_hat scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_pvscan_systemd_red_hat@.service scripts/lvm2_tmpfiles_red_hat.conf scripts/Makefile test/Makefile test/api/Makefile test/unit/Makefile tools/Makefile udev/Makefile unit-tests/datastruct/Makefile unit-tests/regex/Makefile unit-tests/mm/Makefile"
|
||||
ac_config_files="$ac_config_files Makefile make.tmpl daemons/Makefile daemons/clvmd/Makefile daemons/cmirrord/Makefile daemons/dmeventd/Makefile daemons/dmeventd/libdevmapper-event.pc daemons/dmeventd/plugins/Makefile daemons/dmeventd/plugins/lvm2/Makefile daemons/dmeventd/plugins/raid/Makefile daemons/dmeventd/plugins/mirror/Makefile daemons/dmeventd/plugins/snapshot/Makefile daemons/dmeventd/plugins/thin/Makefile daemons/lvmetad/Makefile daemons/lvmpolld/Makefile daemons/lvmlockd/Makefile conf/Makefile conf/example.conf conf/lvmlocal.conf conf/command_profile_template.profile conf/metadata_profile_template.profile include/.symlinks include/Makefile lib/Makefile lib/format1/Makefile lib/format_pool/Makefile lib/locking/Makefile lib/mirror/Makefile lib/replicator/Makefile lib/misc/lvm-version.h lib/raid/Makefile lib/snapshot/Makefile lib/thin/Makefile lib/cache_segtype/Makefile libdaemon/Makefile libdaemon/client/Makefile libdaemon/server/Makefile libdm/Makefile libdm/libdevmapper.pc liblvm/Makefile liblvm/liblvm2app.pc man/Makefile po/Makefile python/Makefile python/setup.py scripts/blkdeactivate.sh scripts/blk_availability_init_red_hat scripts/blk_availability_systemd_red_hat.service scripts/clvmd_init_red_hat scripts/cmirrord_init_red_hat scripts/dm_event_systemd_red_hat.service scripts/dm_event_systemd_red_hat.socket scripts/lvm2_cluster_activation_red_hat.sh scripts/lvm2_cluster_activation_systemd_red_hat.service scripts/lvm2_clvmd_systemd_red_hat.service scripts/lvm2_cmirrord_systemd_red_hat.service scripts/lvm2_lvmetad_init_red_hat scripts/lvm2_lvmetad_systemd_red_hat.service scripts/lvm2_lvmetad_systemd_red_hat.socket scripts/lvm2_lvmpolld_init_red_hat scripts/lvm2_lvmpolld_systemd_red_hat.service scripts/lvm2_lvmpolld_systemd_red_hat.socket scripts/lvm2_lvmlockd_systemd_red_hat.service scripts/lvm2_lvmlocking_systemd_red_hat.service scripts/lvm2_monitoring_init_red_hat scripts/lvm2_monitoring_systemd_red_hat.service scripts/lvm2_pvscan_systemd_red_hat@.service scripts/lvm2_tmpfiles_red_hat.conf scripts/Makefile test/Makefile test/api/Makefile test/unit/Makefile tools/Makefile udev/Makefile unit-tests/datastruct/Makefile unit-tests/regex/Makefile unit-tests/mm/Makefile"
|
||||
|
||||
cat >confcache <<\_ACEOF
|
||||
# This file is a shell script that caches the results of configure
|
||||
@ -13997,6 +14228,7 @@ do
|
||||
"daemons/dmeventd/plugins/thin/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/dmeventd/plugins/thin/Makefile" ;;
|
||||
"daemons/lvmetad/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/lvmetad/Makefile" ;;
|
||||
"daemons/lvmpolld/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/lvmpolld/Makefile" ;;
|
||||
"daemons/lvmlockd/Makefile") CONFIG_FILES="$CONFIG_FILES daemons/lvmlockd/Makefile" ;;
|
||||
"conf/Makefile") CONFIG_FILES="$CONFIG_FILES conf/Makefile" ;;
|
||||
"conf/example.conf") CONFIG_FILES="$CONFIG_FILES conf/example.conf" ;;
|
||||
"conf/lvmlocal.conf") CONFIG_FILES="$CONFIG_FILES conf/lvmlocal.conf" ;;
|
||||
@ -14043,6 +14275,8 @@ do
|
||||
"scripts/lvm2_lvmpolld_init_red_hat") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmpolld_init_red_hat" ;;
|
||||
"scripts/lvm2_lvmpolld_systemd_red_hat.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmpolld_systemd_red_hat.service" ;;
|
||||
"scripts/lvm2_lvmpolld_systemd_red_hat.socket") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmpolld_systemd_red_hat.socket" ;;
|
||||
"scripts/lvm2_lvmlockd_systemd_red_hat.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmlockd_systemd_red_hat.service" ;;
|
||||
"scripts/lvm2_lvmlocking_systemd_red_hat.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_lvmlocking_systemd_red_hat.service" ;;
|
||||
"scripts/lvm2_monitoring_init_red_hat") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_monitoring_init_red_hat" ;;
|
||||
"scripts/lvm2_monitoring_systemd_red_hat.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_monitoring_systemd_red_hat.service" ;;
|
||||
"scripts/lvm2_pvscan_systemd_red_hat@.service") CONFIG_FILES="$CONFIG_FILES scripts/lvm2_pvscan_systemd_red_hat@.service" ;;
|
||||
@ -14668,3 +14902,13 @@ if test "$ODIRECT" != yes; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: O_DIRECT disabled: low-memory pvmove may lock up" >&5
|
||||
$as_echo "$as_me: WARNING: O_DIRECT disabled: low-memory pvmove may lock up" >&2;}
|
||||
fi
|
||||
|
||||
if test "$BUILD_LVMLOCKD" == yes && test "$BUILD_LVMPOLLD" == no; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: lvmlockd requires lvmpolld" >&5
|
||||
$as_echo "$as_me: WARNING: lvmlockd requires lvmpolld" >&2;}
|
||||
fi
|
||||
|
||||
if test "$BUILD_LVMLOCKD" == yes && test "$BUILD_LVMETAD" == no; then :
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: lvmlockd requires lvmetad" >&5
|
||||
$as_echo "$as_me: WARNING: lvmlockd requires lvmetad" >&2;}
|
||||
fi
|
||||
|
57
configure.in
57
configure.in
@ -39,6 +39,7 @@ case "$host_os" in
|
||||
DEVMAPPER=yes
|
||||
LVMETAD=no
|
||||
LVMPOLLD=no
|
||||
LVMLOCKD=no
|
||||
ODIRECT=yes
|
||||
DM_IOCTLS=yes
|
||||
SELINUX=yes
|
||||
@ -1138,6 +1139,50 @@ AC_DEFINE_UNQUOTED(DEFAULT_USE_LVMPOLLD, [$DEFAULT_USE_LVMPOLLD],
|
||||
[Use lvmpolld by default.])
|
||||
|
||||
################################################################################
|
||||
dnl -- Build lvmlockd
|
||||
AC_MSG_CHECKING(whether to build lvmlockd)
|
||||
AC_ARG_ENABLE(lvmlockd,
|
||||
AC_HELP_STRING([--enable-lvmlockd],
|
||||
[enable the LVM lock daemon]),
|
||||
LVMLOCKD=$enableval)
|
||||
AC_MSG_RESULT($LVMLOCKD)
|
||||
|
||||
BUILD_LVMLOCKD=$LVMLOCKD
|
||||
|
||||
if test "$BUILD_LVMLOCKD" = yes; then
|
||||
AC_MSG_CHECKING([defaults for use_lvmlockd])
|
||||
AC_ARG_ENABLE(use_lvmlockd,
|
||||
AC_HELP_STRING([--disable-use-lvmlockd],
|
||||
[disable usage of LVM lock daemon]),
|
||||
[case ${enableval} in
|
||||
yes) DEFAULT_USE_LVMLOCKD=1 ;;
|
||||
*) DEFAULT_USE_LVMLOCKD=0 ;;
|
||||
esac], DEFAULT_USE_LVMLOCKD=1)
|
||||
AC_MSG_RESULT($DEFAULT_USE_LVMLOCKD)
|
||||
AC_DEFINE([LVMLOCKD_SUPPORT], 1, [Define to 1 to include code that uses lvmlockd.])
|
||||
|
||||
AC_ARG_WITH(lvmlockd-pidfile,
|
||||
AC_HELP_STRING([--with-lvmlockd-pidfile=PATH],
|
||||
[lvmlockd pidfile [PID_DIR/lvmlockd.pid]]),
|
||||
LVMLOCKD_PIDFILE=$withval,
|
||||
LVMLOCKD_PIDFILE="$DEFAULT_PID_DIR/lvmlockd.pid")
|
||||
AC_DEFINE_UNQUOTED(LVMLOCKD_PIDFILE, ["$LVMLOCKD_PIDFILE"],
|
||||
[Path to lvmlockd pidfile.])
|
||||
else
|
||||
DEFAULT_USE_LVMLOCKD=0
|
||||
fi
|
||||
AC_DEFINE_UNQUOTED(DEFAULT_USE_LVMLOCKD, [$DEFAULT_USE_LVMLOCKD],
|
||||
[Use lvmlockd by default.])
|
||||
|
||||
################################################################################
|
||||
dnl -- Look for sanlock and dlm libraries
|
||||
if test "$BUILD_LVMLOCKD" = yes; then
|
||||
PKG_CHECK_MODULES(LOCKD_SANLOCK, libsanlock_client, [HAVE_LOCKD_SANLOCK=yes], $bailout)
|
||||
PKG_CHECK_MODULES(LOCKD_DLM, libdlm, [HAVE_LOCKD_DLM=yes], $bailout)
|
||||
fi
|
||||
|
||||
################################################################################
|
||||
|
||||
dnl -- Enable blkid wiping functionality
|
||||
AC_MSG_CHECKING(whether to enable libblkid detection of signatures when wiping)
|
||||
AC_ARG_ENABLE(blkid_wiping,
|
||||
@ -1758,6 +1803,7 @@ AC_SUBST(BUILD_CMIRRORD)
|
||||
AC_SUBST(BUILD_DMEVENTD)
|
||||
AC_SUBST(BUILD_LVMETAD)
|
||||
AC_SUBST(BUILD_LVMPOLLD)
|
||||
AC_SUBST(BUILD_LVMLOCKD)
|
||||
AC_SUBST(CACHE)
|
||||
AC_SUBST(CFLAGS)
|
||||
AC_SUBST(CFLOW_CMD)
|
||||
@ -1798,6 +1844,7 @@ AC_SUBST(DEFAULT_SYS_DIR)
|
||||
AC_SUBST(DEFAULT_USE_BLKID_WIPING)
|
||||
AC_SUBST(DEFAULT_USE_LVMETAD)
|
||||
AC_SUBST(DEFAULT_USE_LVMPOLLD)
|
||||
AC_SUBST(DEFAULT_USE_LVMLOCKD)
|
||||
AC_SUBST(DEVMAPPER)
|
||||
AC_SUBST(DLM_CFLAGS)
|
||||
AC_SUBST(DLM_LIBS)
|
||||
@ -1875,6 +1922,7 @@ AC_SUBST(WRITE_INSTALL)
|
||||
AC_SUBST(DMEVENTD_PIDFILE)
|
||||
AC_SUBST(LVMETAD_PIDFILE)
|
||||
AC_SUBST(LVMPOLLD_PIDFILE)
|
||||
AC_SUBST(LVMLOCKD_PIDFILE)
|
||||
AC_SUBST(CLVMD_PIDFILE)
|
||||
AC_SUBST(CMIRRORD_PIDFILE)
|
||||
AC_SUBST(interface)
|
||||
@ -1909,6 +1957,7 @@ daemons/dmeventd/plugins/snapshot/Makefile
|
||||
daemons/dmeventd/plugins/thin/Makefile
|
||||
daemons/lvmetad/Makefile
|
||||
daemons/lvmpolld/Makefile
|
||||
daemons/lvmlockd/Makefile
|
||||
conf/Makefile
|
||||
conf/example.conf
|
||||
conf/lvmlocal.conf
|
||||
@ -1955,6 +2004,8 @@ scripts/lvm2_lvmetad_systemd_red_hat.socket
|
||||
scripts/lvm2_lvmpolld_init_red_hat
|
||||
scripts/lvm2_lvmpolld_systemd_red_hat.service
|
||||
scripts/lvm2_lvmpolld_systemd_red_hat.socket
|
||||
scripts/lvm2_lvmlockd_systemd_red_hat.service
|
||||
scripts/lvm2_lvmlocking_systemd_red_hat.service
|
||||
scripts/lvm2_monitoring_init_red_hat
|
||||
scripts/lvm2_monitoring_systemd_red_hat.service
|
||||
scripts/lvm2_pvscan_systemd_red_hat@.service
|
||||
@ -1982,3 +2033,9 @@ AS_IF([test -n "$CACHE_CONFIGURE_WARN"],
|
||||
|
||||
AS_IF([test "$ODIRECT" != yes],
|
||||
[AC_MSG_WARN([O_DIRECT disabled: low-memory pvmove may lock up])])
|
||||
|
||||
AS_IF([test "$BUILD_LVMLOCKD" == yes && test "$BUILD_LVMPOLLD" == no],
|
||||
[AC_MSG_WARN([lvmlockd requires lvmpolld])])
|
||||
|
||||
AS_IF([test "$BUILD_LVMLOCKD" == yes && test "$BUILD_LVMETAD" == no],
|
||||
[AC_MSG_WARN([lvmlockd requires lvmetad])])
|
||||
|
@ -15,7 +15,7 @@ srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
.PHONY: dmeventd clvmd cmirrord lvmetad lvmpolld
|
||||
.PHONY: dmeventd clvmd cmirrord lvmetad lvmpolld lvmlockd
|
||||
|
||||
ifneq ("@CLVMD@", "none")
|
||||
SUBDIRS += clvmd
|
||||
@ -40,8 +40,12 @@ ifeq ("@BUILD_LVMPOLLD@", "yes")
|
||||
SUBDIRS += lvmpolld
|
||||
endif
|
||||
|
||||
ifeq ("@BUILD_LVMLOCKD@", "yes")
|
||||
SUBDIRS += lvmlockd
|
||||
endif
|
||||
|
||||
ifeq ($(MAKECMDGOALS),distclean)
|
||||
SUBDIRS = clvmd cmirrord dmeventd lvmetad lvmpolld
|
||||
SUBDIRS = clvmd cmirrord dmeventd lvmetad lvmpolld lvmlockd
|
||||
endif
|
||||
|
||||
include $(top_builddir)/make.tmpl
|
||||
|
53
daemons/lvmlockd/Makefile.in
Normal file
53
daemons/lvmlockd/Makefile.in
Normal file
@ -0,0 +1,53 @@
|
||||
#
|
||||
# Copyright (C) 2014-2015 Red Hat, Inc.
|
||||
#
|
||||
# This file is part of LVM2.
|
||||
#
|
||||
# This copyrighted material is made available to anyone wishing to use,
|
||||
# modify, copy, or redistribute it subject to the terms and conditions
|
||||
# of the GNU Lesser General Public License v.2.1.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public License
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
srcdir = @srcdir@
|
||||
top_srcdir = @top_srcdir@
|
||||
top_builddir = @top_builddir@
|
||||
|
||||
SOURCES = \
|
||||
lvmlockd-core.c \
|
||||
lvmlockd-sanlock.c \
|
||||
lvmlockd-dlm.c
|
||||
|
||||
TARGETS = lvmlockd lvmlockctl
|
||||
|
||||
.PHONY: install_lvmlockd
|
||||
|
||||
include $(top_builddir)/make.tmpl
|
||||
|
||||
INCLUDES += -I$(top_srcdir)/libdaemon/server
|
||||
LVMLIBS = -ldaemonserver $(LVMINTERNAL_LIBS) -ldevmapper
|
||||
|
||||
LIBS += $(PTHREAD_LIBS) -ldlm_lt -lsanlock_client -lrt
|
||||
|
||||
LDFLAGS += -L$(top_builddir)/libdaemon/server
|
||||
CLDFLAGS += -L$(top_builddir)/libdaemon/server
|
||||
|
||||
lvmlockd: $(OBJECTS) $(top_builddir)/libdaemon/client/libdaemonclient.a \
|
||||
$(top_builddir)/libdaemon/server/libdaemonserver.a
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $(OBJECTS) $(LVMLIBS) $(LIBS)
|
||||
|
||||
lvmlockctl: lvmlockctl.o $(top_builddir)/libdaemon/client/libdaemonclient.a \
|
||||
$(top_builddir)/libdaemon/server/libdaemonserver.a
|
||||
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ lvmlockctl.o $(LVMLIBS)
|
||||
|
||||
install_lvmlockd: lvmlockd
|
||||
$(INSTALL_PROGRAM) -D $< $(sbindir)/$(<F)
|
||||
|
||||
install_lvmlockctl: lvmlockctl
|
||||
$(INSTALL_PROGRAM) -D $< $(sbindir)/$(<F)
|
||||
|
||||
install_lvm2: install_lvmlockd install_lvmlockctl
|
||||
|
||||
install: install_lvm2
|
635
daemons/lvmlockd/lvmlockctl.c
Normal file
635
daemons/lvmlockd/lvmlockctl.c
Normal file
@ -0,0 +1,635 @@
|
||||
#define _GNU_SOURCE
|
||||
#include "configure.h"
|
||||
#include "lvmlockd-client.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <getopt.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
static int quit;
|
||||
static int info;
|
||||
static int dump;
|
||||
static int wait_opt;
|
||||
static int force_opt;
|
||||
static int gl_enable;
|
||||
static int gl_disable;
|
||||
static int stop_lockspaces;
|
||||
static char *able_vg_name;
|
||||
|
||||
#define DUMP_SOCKET_NAME "lvmlockd-dump.sock"
|
||||
#define DUMP_BUF_SIZE (1024 * 1024)
|
||||
static char dump_buf[DUMP_BUF_SIZE];
|
||||
static int dump_len;
|
||||
static struct sockaddr_un dump_addr;
|
||||
static socklen_t dump_addrlen;
|
||||
|
||||
daemon_handle _lvmlockd;
|
||||
|
||||
#define log_debug(fmt, args...) \
|
||||
do { \
|
||||
printf(fmt "\n", ##args); \
|
||||
} while (0)
|
||||
|
||||
#define log_error(fmt, args...) \
|
||||
do { \
|
||||
printf(fmt "\n", ##args); \
|
||||
} while (0)
|
||||
|
||||
#define MAX_LINE 512
|
||||
|
||||
/* copied from lvmlockd-internal.h */
|
||||
#define MAX_NAME 64
|
||||
#define MAX_ARGS 64
|
||||
|
||||
/*
|
||||
* lvmlockd dumps the client info before the lockspaces,
|
||||
* so we can look up client info when printing lockspace info.
|
||||
*/
|
||||
|
||||
#define MAX_CLIENTS 100
|
||||
|
||||
struct client_info {
|
||||
uint32_t client_id;
|
||||
int pid;
|
||||
char name[MAX_NAME+1];
|
||||
};
|
||||
|
||||
static struct client_info clients[MAX_CLIENTS];
|
||||
static int num_clients;
|
||||
|
||||
static void save_client_info(char *line)
|
||||
{
|
||||
uint32_t pid = 0;
|
||||
int fd = 0;
|
||||
int pi = 0;
|
||||
uint32_t client_id = 0;
|
||||
char name[MAX_NAME+1] = { 0 };
|
||||
|
||||
sscanf(line, "info=client pid=%u fd=%d pi=%d id=%u name=%s",
|
||||
&pid, &fd, &pi, &client_id, name);
|
||||
|
||||
clients[num_clients].client_id = client_id;
|
||||
clients[num_clients].pid = pid;
|
||||
strcpy(clients[num_clients].name, name);
|
||||
num_clients++;
|
||||
}
|
||||
|
||||
static void find_client_info(uint32_t client_id, uint32_t *pid, char *cl_name)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < num_clients; i++) {
|
||||
if (clients[i].client_id == client_id) {
|
||||
*pid = clients[i].pid;
|
||||
strcpy(cl_name, clients[i].name);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void format_info_ls(char *line)
|
||||
{
|
||||
char ls_name[MAX_NAME+1] = { 0 };
|
||||
char vg_name[MAX_NAME+1] = { 0 };
|
||||
char vg_uuid[MAX_NAME+1] = { 0 };
|
||||
char vg_sysid[MAX_NAME+1] = { 0 };
|
||||
char lock_args[MAX_ARGS+1] = { 0 };
|
||||
char lock_type[MAX_NAME+1] = { 0 };
|
||||
|
||||
sscanf(line, "info=ls ls_name=%s vg_name=%s vg_uuid=%s vg_sysid=%s vg_args=%s lm_type=%s",
|
||||
ls_name, vg_name, vg_uuid, vg_sysid, lock_args, lock_type);
|
||||
|
||||
printf("\n");
|
||||
|
||||
printf("VG %s lock_type=%s %s\n", vg_name, lock_type, vg_uuid);
|
||||
|
||||
printf("LS %s %s\n", lock_type, ls_name);
|
||||
}
|
||||
|
||||
static void format_info_ls_action(char *line)
|
||||
{
|
||||
uint32_t client_id = 0;
|
||||
char flags[MAX_NAME+1] = { 0 };
|
||||
char version[MAX_NAME+1] = { 0 };
|
||||
char op[MAX_NAME+1] = { 0 };
|
||||
uint32_t pid = 0;
|
||||
char cl_name[MAX_NAME+1] = { 0 };
|
||||
|
||||
sscanf(line, "info=ls_action client_id=%u %s %s op=%s",
|
||||
&client_id, flags, version, op);
|
||||
|
||||
find_client_info(client_id, &pid, cl_name);
|
||||
|
||||
printf("OP %s pid %u (%s)", op, pid, cl_name);
|
||||
}
|
||||
|
||||
static void format_info_r(char *line, char *r_name_out, char *r_type_out)
|
||||
{
|
||||
char r_name[MAX_NAME+1] = { 0 };
|
||||
char r_type[4] = { 0 };
|
||||
char mode[4] = { 0 };
|
||||
char sh_count[MAX_NAME+1] = { 0 };
|
||||
uint32_t ver = 0;
|
||||
|
||||
sscanf(line, "info=r name=%s type=%s mode=%s %s version=%u",
|
||||
r_name, r_type, mode, sh_count, &ver);
|
||||
|
||||
/* when mode is not un, wait and print each lk line */
|
||||
|
||||
if (strcmp(mode, "un")) {
|
||||
strcpy(r_name_out, r_name);
|
||||
strcpy(r_type_out, r_type);
|
||||
return;
|
||||
}
|
||||
|
||||
/* when mode is un, there will be no lk lines, so print now */
|
||||
|
||||
if (!strcmp(r_type, "gl")) {
|
||||
printf("LK GL un ver %4u\n", ver);
|
||||
|
||||
} else if (!strcmp(r_type, "vg")) {
|
||||
printf("LK VG un ver %4u\n", ver);
|
||||
|
||||
} else if (!strcmp(r_type, "lv")) {
|
||||
printf("LK LV un %s\n", r_name);
|
||||
}
|
||||
}
|
||||
|
||||
static void format_info_lk(char *line, char *r_name, char *r_type)
|
||||
{
|
||||
char mode[4] = { 0 };
|
||||
uint32_t ver = 0;
|
||||
char flags[MAX_NAME+1] = { 0 };
|
||||
uint32_t client_id = 0;
|
||||
uint32_t pid = 0;
|
||||
char cl_name[MAX_NAME+1] = { 0 };
|
||||
|
||||
if (!r_name[0] || !r_type[0]) {
|
||||
printf("format_info_lk error r_name %s r_type %s\n", r_name, r_type);
|
||||
printf("%s\n", line);
|
||||
return;
|
||||
}
|
||||
|
||||
sscanf(line, "info=lk mode=%s version=%u %s client_id=%u",
|
||||
mode, &ver, flags, &client_id);
|
||||
|
||||
find_client_info(client_id, &pid, cl_name);
|
||||
|
||||
if (!strcmp(r_type, "gl")) {
|
||||
printf("LK GL %s ver %4u pid %u (%s)\n", mode, ver, pid, cl_name);
|
||||
|
||||
} else if (!strcmp(r_type, "vg")) {
|
||||
printf("LK VG %s ver %4u pid %u (%s)\n", mode, ver, pid, cl_name);
|
||||
|
||||
} else if (!strcmp(r_type, "lv")) {
|
||||
printf("LK LV %s %s\n", mode, r_name);
|
||||
}
|
||||
}
|
||||
|
||||
static void format_info_r_action(char *line, char *r_name, char *r_type)
|
||||
{
|
||||
uint32_t client_id = 0;
|
||||
char flags[MAX_NAME+1] = { 0 };
|
||||
char version[MAX_NAME+1] = { 0 };
|
||||
char op[MAX_NAME+1] = { 0 };
|
||||
char rt[4] = { 0 };
|
||||
char mode[4] = { 0 };
|
||||
char lm[MAX_NAME+1] = { 0 };
|
||||
char result[MAX_NAME+1] = { 0 };
|
||||
char lm_rv[MAX_NAME+1] = { 0 };
|
||||
uint32_t pid = 0;
|
||||
char cl_name[MAX_NAME+1] = { 0 };
|
||||
|
||||
if (!r_name[0] || !r_type[0]) {
|
||||
printf("format_info_r_action error r_name %s r_type %s\n", r_name, r_type);
|
||||
printf("%s\n", line);
|
||||
return;
|
||||
}
|
||||
|
||||
sscanf(line, "info=r_action client_id=%u %s %s op=%s rt=%s mode=%s %s %s %s",
|
||||
&client_id, flags, version, op, rt, mode, lm, result, lm_rv);
|
||||
|
||||
find_client_info(client_id, &pid, cl_name);
|
||||
|
||||
if (strcmp(op, "lock")) {
|
||||
printf("OP %s pid %u (%s)", op, pid, cl_name);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!strcmp(r_type, "gl")) {
|
||||
printf("LW GL %s ver %4u pid %u (%s)\n", mode, 0, pid, cl_name);
|
||||
|
||||
} else if (!strcmp(r_type, "vg")) {
|
||||
printf("LW VG %s ver %4u pid %u (%s)\n", mode, 0, pid, cl_name);
|
||||
|
||||
} else if (!strcmp(r_type, "lv")) {
|
||||
printf("LW LV %s %s\n", mode, r_name);
|
||||
}
|
||||
}
|
||||
|
||||
static void format_info_line(char *line)
|
||||
{
|
||||
char r_name[MAX_NAME+1];
|
||||
char r_type[MAX_NAME+1];
|
||||
|
||||
if (!strncmp(line, "info=structs ", strlen("info=structs "))) {
|
||||
printf("%s\n", line);
|
||||
|
||||
} else if (!strncmp(line, "info=client ", strlen("info=client "))) {
|
||||
save_client_info(line);
|
||||
|
||||
} else if (!strncmp(line, "info=ls ", strlen("info=ls "))) {
|
||||
format_info_ls(line);
|
||||
|
||||
} else if (!strncmp(line, "info=ls_action ", strlen("info=ls_action "))) {
|
||||
format_info_ls_action(line);
|
||||
|
||||
} else if (!strncmp(line, "info=r ", strlen("info=r "))) {
|
||||
memset(r_name, 0, sizeof(r_name));
|
||||
memset(r_type, 0, sizeof(r_type));
|
||||
format_info_r(line, r_name, r_type);
|
||||
|
||||
} else if (!strncmp(line, "info=lk ", strlen("info=lk "))) {
|
||||
/* will use info from previous r */
|
||||
format_info_lk(line, r_name, r_type);
|
||||
|
||||
} else if (!strncmp(line, "info=r_action ", strlen("info=r_action "))) {
|
||||
/* will use info from previous r */
|
||||
format_info_r_action(line, r_name, r_type);
|
||||
} else {
|
||||
printf("UN %s\n", line);
|
||||
}
|
||||
}
|
||||
|
||||
static void format_info(void)
|
||||
{
|
||||
char line[MAX_LINE];
|
||||
int i, j;
|
||||
|
||||
j = 0;
|
||||
memset(line, 0, sizeof(line));
|
||||
|
||||
for (i = 0; i < dump_len; i++) {
|
||||
line[j++] = dump_buf[i];
|
||||
|
||||
if ((line[j-1] == '\n') || (line[j-1] == '\0')) {
|
||||
format_info_line(line);
|
||||
j = 0;
|
||||
memset(line, 0, sizeof(line));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static daemon_reply _lvmlockd_send(const char *req_name, ...)
|
||||
{
|
||||
va_list ap;
|
||||
daemon_reply repl;
|
||||
daemon_request req;
|
||||
|
||||
req = daemon_request_make(req_name);
|
||||
|
||||
va_start(ap, req_name);
|
||||
daemon_request_extend_v(req, ap);
|
||||
va_end(ap);
|
||||
|
||||
repl = daemon_send(_lvmlockd, req);
|
||||
|
||||
daemon_request_destroy(req);
|
||||
|
||||
return repl;
|
||||
}
|
||||
|
||||
/* See the same in lib/locking/lvmlockd.c */
|
||||
#define NO_LOCKD_RESULT -1000
|
||||
|
||||
static int _lvmlockd_result(daemon_reply reply, int *result)
|
||||
{
|
||||
int reply_result;
|
||||
const char *reply_flags;
|
||||
const char *lock_type;
|
||||
|
||||
if (reply.error) {
|
||||
log_error("lvmlockd_result reply error %d", reply.error);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (strcmp(daemon_reply_str(reply, "response", ""), "OK")) {
|
||||
log_error("lvmlockd_result bad response");
|
||||
return 0;
|
||||
}
|
||||
|
||||
reply_result = daemon_reply_int(reply, "op_result", NO_LOCKD_RESULT);
|
||||
if (reply_result == -1000) {
|
||||
log_error("lvmlockd_result no op_result");
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* The lock_type that lvmlockd used for locking. */
|
||||
lock_type = daemon_reply_str(reply, "lock_type", "none");
|
||||
|
||||
*result = reply_result;
|
||||
|
||||
reply_flags = daemon_reply_str(reply, "result_flags", NULL);
|
||||
|
||||
log_debug("lvmlockd_result %d %s lm %s", reply_result, reply_flags, lock_type);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int do_quit(void)
|
||||
{
|
||||
daemon_reply reply;
|
||||
int rv = 0;
|
||||
|
||||
reply = daemon_send_simple(_lvmlockd, "quit", NULL);
|
||||
|
||||
if (reply.error) {
|
||||
log_error("reply error %d", reply.error);
|
||||
rv = reply.error;
|
||||
}
|
||||
|
||||
daemon_reply_destroy(reply);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int setup_dump_socket(void)
|
||||
{
|
||||
int s, rv;
|
||||
|
||||
s = socket(AF_LOCAL, SOCK_DGRAM, 0);
|
||||
if (s < 0)
|
||||
return s;
|
||||
|
||||
memset(&dump_addr, 0, sizeof(dump_addr));
|
||||
dump_addr.sun_family = AF_LOCAL;
|
||||
strcpy(&dump_addr.sun_path[1], DUMP_SOCKET_NAME);
|
||||
dump_addrlen = sizeof(sa_family_t) + strlen(dump_addr.sun_path+1) + 1;
|
||||
|
||||
rv = bind(s, (struct sockaddr *) &dump_addr, dump_addrlen);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
static int do_dump(const char *req_name)
|
||||
{
|
||||
daemon_reply reply;
|
||||
int result;
|
||||
int fd, rv = 0;
|
||||
|
||||
fd = setup_dump_socket();
|
||||
if (fd < 0) {
|
||||
log_error("socket error %d", fd);
|
||||
return fd;
|
||||
}
|
||||
|
||||
reply = daemon_send_simple(_lvmlockd, req_name, NULL);
|
||||
|
||||
if (reply.error) {
|
||||
log_error("reply error %d", reply.error);
|
||||
rv = reply.error;
|
||||
goto out;
|
||||
}
|
||||
|
||||
result = daemon_reply_int(reply, "result", 0);
|
||||
dump_len = daemon_reply_int(reply, "dump_len", 0);
|
||||
|
||||
daemon_reply_destroy(reply);
|
||||
|
||||
if (result < 0) {
|
||||
rv = result;
|
||||
log_error("result %d", result);
|
||||
}
|
||||
|
||||
if (!dump_len)
|
||||
goto out;
|
||||
|
||||
memset(dump_buf, 0, sizeof(dump_buf));
|
||||
|
||||
rv = recvfrom(fd, dump_buf, dump_len, MSG_WAITALL,
|
||||
(struct sockaddr *)&dump_addr, &dump_addrlen);
|
||||
if (rv < 0) {
|
||||
log_error("recvfrom error %d %d", rv, errno);
|
||||
rv = -errno;
|
||||
goto out;
|
||||
}
|
||||
|
||||
rv = 0;
|
||||
if ((info && dump) || !strcmp(req_name, "dump"))
|
||||
printf("%s\n", dump_buf);
|
||||
else
|
||||
format_info();
|
||||
out:
|
||||
close(fd);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int do_able(const char *req_name)
|
||||
{
|
||||
daemon_reply reply;
|
||||
int result;
|
||||
int rv;
|
||||
|
||||
reply = _lvmlockd_send(req_name,
|
||||
"cmd = %s", "lvmlock",
|
||||
"pid = %d", getpid(),
|
||||
"vg_name = %s", able_vg_name,
|
||||
NULL);
|
||||
|
||||
if (!_lvmlockd_result(reply, &result)) {
|
||||
log_error("lvmlockd result %d", result);
|
||||
rv = result;
|
||||
} else {
|
||||
rv = 0;
|
||||
}
|
||||
|
||||
daemon_reply_destroy(reply);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int do_stop_lockspaces(void)
|
||||
{
|
||||
daemon_reply reply;
|
||||
char opts[32];
|
||||
int result;
|
||||
int rv;
|
||||
|
||||
memset(opts, 0, sizeof(opts));
|
||||
|
||||
if (wait_opt)
|
||||
strcat(opts, "wait ");
|
||||
if (force_opt)
|
||||
strcat(opts, "force ");
|
||||
|
||||
reply = _lvmlockd_send("stop_all",
|
||||
"cmd = %s", "lvmlock",
|
||||
"pid = %d", getpid(),
|
||||
"opts = %s", opts[0] ? opts : "none",
|
||||
NULL);
|
||||
|
||||
if (!_lvmlockd_result(reply, &result)) {
|
||||
log_error("lvmlockd result %d", result);
|
||||
rv = result;
|
||||
} else {
|
||||
rv = 0;
|
||||
}
|
||||
|
||||
daemon_reply_destroy(reply);
|
||||
return rv;
|
||||
}
|
||||
|
||||
static void print_usage(void)
|
||||
{
|
||||
printf("lvmlockctl options\n");
|
||||
printf("Options:\n");
|
||||
printf("--help | -h\n");
|
||||
printf(" Show this help information.\n");
|
||||
printf("--quit | -q\n");
|
||||
printf(" Tell lvmlockd to quit.\n");
|
||||
printf("--info | -i\n");
|
||||
printf(" Print lock state information from lvmlockd.\n");
|
||||
printf("--dump | -d\n");
|
||||
printf(" Print log buffer from lvmlockd.\n");
|
||||
printf("--wait | -w 0|1\n");
|
||||
printf(" Wait option for other commands.\n");
|
||||
printf("--force | -f 0|1>\n");
|
||||
printf(" Force option for other commands.\n");
|
||||
printf("--stop-lockspaces | -S\n");
|
||||
printf(" Stop all lockspaces.\n");
|
||||
printf("--gl-enable <vg_name>\n");
|
||||
printf(" Tell lvmlockd to enable the global lock in a sanlock vg.\n");
|
||||
printf("--gl-disable <vg_name>\n");
|
||||
printf(" Tell lvmlockd to disable the global lock in a sanlock vg.\n");
|
||||
}
|
||||
|
||||
static int read_options(int argc, char *argv[])
|
||||
{
|
||||
int option_index = 0;
|
||||
int c;
|
||||
|
||||
static struct option long_options[] = {
|
||||
{"help", no_argument, 0, 'h' },
|
||||
{"quit", no_argument, 0, 'q' },
|
||||
{"info", no_argument, 0, 'i' },
|
||||
{"dump", no_argument, 0, 'd' },
|
||||
{"wait", required_argument, 0, 'w' },
|
||||
{"force", required_argument, 0, 'f' },
|
||||
{"gl-enable", required_argument, 0, 'E' },
|
||||
{"gl-disable", required_argument, 0, 'D' },
|
||||
{"stop-lockspaces", no_argument, 0, 'S' },
|
||||
{0, 0, 0, 0 }
|
||||
};
|
||||
|
||||
if (argc == 1) {
|
||||
print_usage();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
while (1) {
|
||||
c = getopt_long(argc, argv, "hqidE:D:w:S", long_options, &option_index);
|
||||
if (c == -1)
|
||||
break;
|
||||
|
||||
switch (c) {
|
||||
case 'h':
|
||||
/* --help */
|
||||
print_usage();
|
||||
exit(0);
|
||||
case 'q':
|
||||
/* --quit */
|
||||
quit = 1;
|
||||
break;
|
||||
case 'i':
|
||||
/* --info */
|
||||
info = 1;
|
||||
break;
|
||||
case 'd':
|
||||
/* --dump */
|
||||
dump = 1;
|
||||
break;
|
||||
case 'w':
|
||||
wait_opt = atoi(optarg);
|
||||
break;
|
||||
case 'E':
|
||||
gl_enable = 1;
|
||||
able_vg_name = strdup(optarg);
|
||||
break;
|
||||
case 'D':
|
||||
gl_disable = 1;
|
||||
able_vg_name = strdup(optarg);
|
||||
break;
|
||||
case 'S':
|
||||
stop_lockspaces = 1;
|
||||
break;
|
||||
default:
|
||||
print_usage();
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int rv = 0;
|
||||
|
||||
rv = read_options(argc, argv);
|
||||
if (rv < 0)
|
||||
return rv;
|
||||
|
||||
_lvmlockd = lvmlockd_open(NULL);
|
||||
|
||||
if (_lvmlockd.socket_fd < 0 || _lvmlockd.error) {
|
||||
log_error("lvmlockd open error %d", _lvmlockd.error);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (quit) {
|
||||
rv = do_quit();
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (info) {
|
||||
rv = do_dump("info");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (dump) {
|
||||
rv = do_dump("dump");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (gl_enable) {
|
||||
rv = do_able("enable_gl");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (gl_disable) {
|
||||
rv = do_able("disable_gl");
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (stop_lockspaces) {
|
||||
rv = do_stop_lockspaces();
|
||||
goto out;
|
||||
}
|
||||
|
||||
out:
|
||||
lvmlockd_close(_lvmlockd);
|
||||
return rv;
|
||||
}
|
||||
|
49
daemons/lvmlockd/lvmlockd-client.h
Normal file
49
daemons/lvmlockd/lvmlockd-client.h
Normal file
@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Red Hat, Inc.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use,
|
||||
* modify, copy, or redistribute it subject to the terms and conditions
|
||||
* of the GNU Lesser General Public License v.2.1.
|
||||
*/
|
||||
|
||||
#ifndef _LVM_LVMLOCKD_CLIENT_H
|
||||
#define _LVM_LVMLOCKD_CLIENT_H
|
||||
|
||||
#include "daemon-client.h"
|
||||
|
||||
#define LVMLOCKD_SOCKET DEFAULT_RUN_DIR "/lvmlockd.socket"
|
||||
|
||||
/* Wrappers to open/close connection */
|
||||
|
||||
static inline daemon_handle lvmlockd_open(const char *sock)
|
||||
{
|
||||
daemon_info lvmlockd_info = {
|
||||
.path = "lvmlockd",
|
||||
.socket = sock ?: LVMLOCKD_SOCKET,
|
||||
.protocol = "lvmlockd",
|
||||
.protocol_version = 1,
|
||||
.autostart = 0
|
||||
};
|
||||
|
||||
return daemon_open(lvmlockd_info);
|
||||
}
|
||||
|
||||
static inline void lvmlockd_close(daemon_handle h)
|
||||
{
|
||||
return daemon_close(h);
|
||||
}
|
||||
|
||||
/*
|
||||
* Errors returned as the lvmlockd result value.
|
||||
*/
|
||||
#define ENOLS 210 /* lockspace not found */
|
||||
#define ESTARTING 211 /* lockspace is starting */
|
||||
#define EARGS 212
|
||||
#define EHOSTID 213
|
||||
#define EMANAGER 214
|
||||
#define EPREPARE 215
|
||||
#define ELOCKD 216
|
||||
|
||||
#endif
|
5715
daemons/lvmlockd/lvmlockd-core.c
Normal file
5715
daemons/lvmlockd/lvmlockd-core.c
Normal file
File diff suppressed because it is too large
Load Diff
666
daemons/lvmlockd/lvmlockd-dlm.c
Normal file
666
daemons/lvmlockd/lvmlockd-dlm.c
Normal file
@ -0,0 +1,666 @@
|
||||
/*
|
||||
* Copyright (C) 2014 Red Hat, Inc.
|
||||
*
|
||||
* This file is part of LVM2.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use,
|
||||
* modify, copy, or redistribute it subject to the terms and conditions
|
||||
* of the GNU Lesser General Public License v.2.1.
|
||||
*/
|
||||
|
||||
#define _XOPEN_SOURCE 500 /* pthread */
|
||||
#define _ISOC99_SOURCE
|
||||
#define _GNU_SOURCE
|
||||
|
||||
#include <assert.h>
|
||||
#include <pthread.h>
|
||||
#include <stdint.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <poll.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <endian.h>
|
||||
#include <fcntl.h>
|
||||
#include <byteswap.h>
|
||||
#include <syslog.h>
|
||||
#include <dirent.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/socket.h>
|
||||
|
||||
#include "configure.h"
|
||||
#include "daemon-server.h"
|
||||
#include "daemon-log.h"
|
||||
#include "xlate.h"
|
||||
|
||||
#include "lvmlockd-internal.h"
|
||||
#include "lvmlockd-client.h"
|
||||
|
||||
/*
|
||||
* Using synchronous _wait dlm apis so do not define _REENTRANT and
|
||||
* link with non-threaded version of library, libdlm_lt.
|
||||
*/
|
||||
#include "libdlm.h"
|
||||
|
||||
struct lm_dlm {
|
||||
dlm_lshandle_t *dh;
|
||||
};
|
||||
|
||||
struct rd_dlm {
|
||||
struct dlm_lksb lksb;
|
||||
struct val_blk *vb;
|
||||
};
|
||||
|
||||
int lm_data_size_dlm(void)
|
||||
{
|
||||
return sizeof(struct rd_dlm);
|
||||
}
|
||||
|
||||
/*
|
||||
* lock_args format
|
||||
*
|
||||
* vg_lock_args format for dlm is
|
||||
* vg_version_string:undefined:cluster_name
|
||||
*
|
||||
* lv_lock_args are not used for dlm
|
||||
*
|
||||
* version_string is MAJOR.MINOR.PATCH
|
||||
* undefined may contain ":"
|
||||
*/
|
||||
|
||||
#define VG_LOCK_ARGS_MAJOR 1
|
||||
#define VG_LOCK_ARGS_MINOR 0
|
||||
#define VG_LOCK_ARGS_PATCH 0
|
||||
|
||||
static int cluster_name_from_args(char *vg_args, char *clustername)
|
||||
{
|
||||
return last_string_from_args(vg_args, clustername);
|
||||
}
|
||||
|
||||
static int check_args_version(char *vg_args)
|
||||
{
|
||||
unsigned int major = 0;
|
||||
int rv;
|
||||
|
||||
rv = version_from_args(vg_args, &major, NULL, NULL);
|
||||
if (rv < 0) {
|
||||
log_error("check_args_version %s error %d", vg_args, rv);
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (major > VG_LOCK_ARGS_MAJOR) {
|
||||
log_error("check_args_version %s major %d %d", vg_args, major, VG_LOCK_ARGS_MAJOR);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* This will be set after dlm_controld is started. */
|
||||
#define DLM_CLUSTER_NAME_PATH "/sys/kernel/config/dlm/cluster/cluster_name"
|
||||
|
||||
static int read_cluster_name(char *clustername)
|
||||
{
|
||||
char *n;
|
||||
int fd;
|
||||
int rv;
|
||||
|
||||
if (daemon_test) {
|
||||
sprintf(clustername, "%s", "test");
|
||||
return 0;
|
||||
}
|
||||
|
||||
fd = open(DLM_CLUSTER_NAME_PATH, O_RDONLY);
|
||||
if (fd < 0) {
|
||||
log_debug("read_cluster_name: open error %d, check dlm_controld", fd);
|
||||
return fd;
|
||||
}
|
||||
|
||||
rv = read(fd, clustername, MAX_ARGS - 1);
|
||||
if (rv < 0) {
|
||||
log_error("read_cluster_name: cluster name read error %d, check dlm_controld", fd);
|
||||
close(fd);
|
||||
return rv;
|
||||
}
|
||||
|
||||
n = strstr(clustername, "\n");
|
||||
if (n)
|
||||
*n = '\0';
|
||||
close(fd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lm_init_vg_dlm(char *ls_name, char *vg_name, uint32_t flags, char *vg_args)
|
||||
{
|
||||
char clustername[MAX_ARGS];
|
||||
char lock_args_version[MAX_ARGS];
|
||||
int rv;
|
||||
|
||||
memset(clustername, 0, sizeof(clustername));
|
||||
memset(lock_args_version, 0, sizeof(lock_args_version));
|
||||
|
||||
snprintf(lock_args_version, MAX_ARGS, "%u.%u.%u",
|
||||
VG_LOCK_ARGS_MAJOR, VG_LOCK_ARGS_MINOR, VG_LOCK_ARGS_PATCH);
|
||||
|
||||
rv = read_cluster_name(clustername);
|
||||
if (rv < 0)
|
||||
return -EMANAGER;
|
||||
|
||||
if (strlen(clustername) + strlen(lock_args_version) + 2 > MAX_ARGS) {
|
||||
log_error("init_vg_dlm args too long");
|
||||
return -EARGS;
|
||||
}
|
||||
|
||||
snprintf(vg_args, MAX_ARGS, "%s:%s", lock_args_version, clustername);
|
||||
rv = 0;
|
||||
|
||||
log_debug("init_vg_dlm done %s vg_args %s", ls_name, vg_args);
|
||||
return rv;
|
||||
}
|
||||
|
||||
int lm_prepare_lockspace_dlm(struct lockspace *ls)
|
||||
{
|
||||
char sys_clustername[MAX_ARGS];
|
||||
char arg_clustername[MAX_ARGS];
|
||||
struct lm_dlm *lmd;
|
||||
int rv;
|
||||
|
||||
memset(sys_clustername, 0, sizeof(sys_clustername));
|
||||
memset(arg_clustername, 0, sizeof(arg_clustername));
|
||||
|
||||
rv = read_cluster_name(sys_clustername);
|
||||
if (rv < 0)
|
||||
return -EMANAGER;
|
||||
|
||||
if (!ls->vg_args[0]) {
|
||||
/* global lockspace has no vg args */
|
||||
goto skip_args;
|
||||
}
|
||||
|
||||
rv = check_args_version(ls->vg_args);
|
||||
if (rv < 0)
|
||||
return -EARGS;
|
||||
|
||||
rv = cluster_name_from_args(ls->vg_args, arg_clustername);
|
||||
if (rv < 0) {
|
||||
log_error("prepare_lockspace_dlm %s no cluster name from args %s", ls->name, ls->vg_args);
|
||||
return -EARGS;
|
||||
}
|
||||
|
||||
if (strcmp(sys_clustername, arg_clustername)) {
|
||||
log_error("prepare_lockspace_dlm %s mismatching cluster names sys %s arg %s",
|
||||
ls->name, sys_clustername, arg_clustername);
|
||||
return -EARGS;
|
||||
}
|
||||
|
||||
skip_args:
|
||||
lmd = malloc(sizeof(struct lm_dlm));
|
||||
if (!lmd)
|
||||
return -ENOMEM;
|
||||
|
||||
ls->lm_data = lmd;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lm_add_lockspace_dlm(struct lockspace *ls, int adopt)
|
||||
{
|
||||
struct lm_dlm *lmd = (struct lm_dlm *)ls->lm_data;
|
||||
|
||||
if (daemon_test)
|
||||
return 0;
|
||||
|
||||
if (adopt)
|
||||
lmd->dh = dlm_open_lockspace(ls->name);
|
||||
else
|
||||
lmd->dh = dlm_new_lockspace(ls->name, 0600, DLM_LSFL_NEWEXCL);
|
||||
|
||||
if (!lmd->dh) {
|
||||
log_error("add_lockspace_dlm %s adopt %d error", ls->name, adopt);
|
||||
free(lmd);
|
||||
ls->lm_data = NULL;
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int lm_rem_lockspace_dlm(struct lockspace *ls, int free_vg)
|
||||
{
|
||||
struct lm_dlm *lmd = (struct lm_dlm *)ls->lm_data;
|
||||
int rv;
|
||||
|
||||
if (daemon_test)
|
||||
goto out;
|
||||
|
||||
/*
|
||||
* If free_vg is set, it means we are doing vgremove, and we may want
|
||||
* to tell any other nodes to leave the lockspace. This is not really
|
||||
* necessary since there should be no harm in having an unused
|
||||
* lockspace sitting around. A new "notification lock" would need to
|
||||
* be added with a callback to signal this.
|
||||
*/
|
||||
|
||||
rv = dlm_release_lockspace(ls->name, lmd->dh, 1);
|
||||
if (rv < 0) {
|
||||
log_error("rem_lockspace_dlm error %d", rv);
|
||||
return rv;
|
||||
}
|
||||
out:
|
||||
free(lmd);
|
||||
ls->lm_data = NULL;
|
||||
|
||||
if (!strcmp(ls->name, gl_lsname_dlm)) {
|
||||
gl_running_dlm = 0;
|
||||
gl_auto_dlm = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int lm_add_resource_dlm(struct lockspace *ls, struct resource *r, int with_lock_nl)
|
||||
{
|
||||
struct lm_dlm *lmd = (struct lm_dlm *)ls->lm_data;
|
||||
struct rd_dlm *rdd = (struct rd_dlm *)r->lm_data;
|
||||
uint32_t flags = 0;
|
||||
char *buf;
|
||||
int rv;
|
||||