mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
blkdeactivate: add -m|--mpathoption disablequeueing and use it for blk-availability systemd service and initscript
blkdeactivate -m disablequeueing causes "multipathd disablequeueing maps" call inside blkdeactivate script before deactivating devices. This avoids a situation where blkdeactivate may wait for paths to appear if multipath is set to queueing and there's a stack of other devices and/or mount points on top of such multipath device. See also https://bugzilla.redhat.com/show_bug.cgi?id=1344381.
This commit is contained in:
parent
9f7e8f22dc
commit
42e76a1920
@ -1,5 +1,7 @@
|
|||||||
Version 1.02.131 -
|
Version 1.02.131 -
|
||||||
================================
|
================================
|
||||||
|
Disable queueing on mpath devs in blk-availability systemd service/initscript.
|
||||||
|
Add new -m|--mpathoption disablequeueing to blkdeactivate.
|
||||||
Automatically group regions with 'create --segments' unless --nogroup.
|
Automatically group regions with 'create --segments' unless --nogroup.
|
||||||
Fix resource leak when deleting the first member of a group.
|
Fix resource leak when deleting the first member of a group.
|
||||||
Allow --bounds with 'create --filemap' for dmstats.
|
Allow --bounds with 'create --filemap' for dmstats.
|
||||||
|
@ -7,6 +7,7 @@ blkdeactivate \(em utility to deactivate block devices
|
|||||||
.RB [ \-e ]
|
.RB [ \-e ]
|
||||||
.RB [ \-h ]
|
.RB [ \-h ]
|
||||||
.RB [ \-l \ \fIlvm_options\fP ]
|
.RB [ \-l \ \fIlvm_options\fP ]
|
||||||
|
.RB [ \-m \ \fImpath_options\fP ]
|
||||||
.RB [ \-u ]
|
.RB [ \-u ]
|
||||||
.RB [ \-v ]
|
.RB [ \-v ]
|
||||||
.RI [ device ]
|
.RI [ device ]
|
||||||
@ -51,6 +52,16 @@ Deactivating Volume Group as a whole takes less time than deactivating each
|
|||||||
Logical Volume separately.
|
Logical Volume separately.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
|
.BR \-m ", " \-\-mpathoption \ \fImpath_options\fP
|
||||||
|
Comma separated list of device-mapper multipath specific options:
|
||||||
|
.RS
|
||||||
|
.IP \fIdisablequeueing\fP
|
||||||
|
Disable queueing on all multipath devices first before deactivation.
|
||||||
|
This avoids a situation where blkdeactivate may end up waiting if
|
||||||
|
all paths are unavailable for any underlying device-mapper multipath
|
||||||
|
device.
|
||||||
|
.RE
|
||||||
|
.TP
|
||||||
.BR \-u ", " \-\-umount
|
.BR \-u ", " \-\-umount
|
||||||
Unmount a mounted device before trying to deactivate it.
|
Unmount a mounted device before trying to deactivate it.
|
||||||
Without this option used, a device that is mounted is not deactivated.
|
Without this option used, a device that is mounted is not deactivated.
|
||||||
@ -90,4 +101,5 @@ of device-mapper devices in case the deactivation fails and force removal.
|
|||||||
.BR lsblk (8),
|
.BR lsblk (8),
|
||||||
.BR lvm (8),
|
.BR lvm (8),
|
||||||
.BR mdadm (8),
|
.BR mdadm (8),
|
||||||
|
.BR multipathd (8),
|
||||||
.BR umount (8)
|
.BR umount (8)
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
|
|
||||||
sbindir=@sbindir@
|
sbindir=@sbindir@
|
||||||
script=blkdeactivate
|
script=blkdeactivate
|
||||||
options="-u -l wholevg"
|
options="-u -l wholevg -m disablequeueing"
|
||||||
|
|
||||||
LOCK_FILE="/var/lock/subsys/blk-availability"
|
LOCK_FILE="/var/lock/subsys/blk-availability"
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ Conflicts=shutdown.target
|
|||||||
[Service]
|
[Service]
|
||||||
Type=oneshot
|
Type=oneshot
|
||||||
ExecStart=/usr/bin/true
|
ExecStart=/usr/bin/true
|
||||||
ExecStop=@sbindir@/blkdeactivate -u -l wholevg
|
ExecStop=@sbindir@/blkdeactivate -u -l wholevg -m disablequeueing
|
||||||
RemainAfterExit=yes
|
RemainAfterExit=yes
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
@ -38,6 +38,7 @@ UMOUNT="/bin/umount"
|
|||||||
DMSETUP="@sbindir@/dmsetup"
|
DMSETUP="@sbindir@/dmsetup"
|
||||||
LVM="@sbindir@/lvm"
|
LVM="@sbindir@/lvm"
|
||||||
MDADM="@sbindir@/mdadm"
|
MDADM="@sbindir@/mdadm"
|
||||||
|
MPATHD="/sbin/multipathd"
|
||||||
|
|
||||||
if $UMOUNT --help | grep -- "--all-targets" >$DEV_DIR/null; then
|
if $UMOUNT --help | grep -- "--all-targets" >$DEV_DIR/null; then
|
||||||
UMOUNT_OPTS="--all-targets "
|
UMOUNT_OPTS="--all-targets "
|
||||||
@ -49,6 +50,7 @@ fi
|
|||||||
DMSETUP_OPTS=""
|
DMSETUP_OPTS=""
|
||||||
LVM_OPTS=""
|
LVM_OPTS=""
|
||||||
MDADM_OPTS=""
|
MDADM_OPTS=""
|
||||||
|
MPATHD_OPTS=""
|
||||||
|
|
||||||
LSBLK="/bin/lsblk -r --noheadings -o TYPE,KNAME,NAME,MOUNTPOINT"
|
LSBLK="/bin/lsblk -r --noheadings -o TYPE,KNAME,NAME,MOUNTPOINT"
|
||||||
LSBLK_VARS="local devtype local kname local name local mnt"
|
LSBLK_VARS="local devtype local kname local name local mnt"
|
||||||
@ -68,6 +70,9 @@ LVM_DO_WHOLE_VG=0
|
|||||||
# Do not retry LV deactivation by default.
|
# Do not retry LV deactivation by default.
|
||||||
LVM_CONFIG="activation{retry_deactivation=0}"
|
LVM_CONFIG="activation{retry_deactivation=0}"
|
||||||
|
|
||||||
|
# Do not disable queueing if set on multipath devices.
|
||||||
|
MPATHD_DO_DISABLEQUEUEING=0
|
||||||
|
|
||||||
#
|
#
|
||||||
# List of device names and/or VGs to be skipped.
|
# List of device names and/or VGs to be skipped.
|
||||||
# Device name is the KNAME from lsblk output.
|
# Device name is the KNAME from lsblk output.
|
||||||
@ -107,20 +112,23 @@ usage() {
|
|||||||
echo " If devices are specified, deactivate only supplied devices and their holders."
|
echo " If devices are specified, deactivate only supplied devices and their holders."
|
||||||
echo
|
echo
|
||||||
echo " Options:"
|
echo " Options:"
|
||||||
echo " -e | --errors Show errors reported from tools"
|
echo " -e | --errors Show errors reported from tools"
|
||||||
echo " -h | --help Show this help message"
|
echo " -h | --help Show this help message"
|
||||||
echo " -d | --dmoption DM_OPTIONS Comma separated DM specific options"
|
echo " -d | --dmoption DM_OPTIONS Comma separated DM specific options"
|
||||||
echo " -l | --lvmoption LVM_OPTIONS Comma separated LVM specific options"
|
echo " -l | --lvmoption LVM_OPTIONS Comma separated LVM specific options"
|
||||||
echo " -u | --umount Unmount the device if mounted"
|
echo " -m | --mpathoption MPATH_OPTIONS Comma separated DM-multipath specific options"
|
||||||
echo " -v | --verbose Verbose mode (also implies -e)"
|
echo " -u | --umount Unmount the device if mounted"
|
||||||
|
echo " -v | --verbose Verbose mode (also implies -e)"
|
||||||
echo
|
echo
|
||||||
echo " Device specific options:"
|
echo " Device specific options:"
|
||||||
echo " DM_OPTIONS:"
|
echo " DM_OPTIONS:"
|
||||||
echo " retry retry removal several times in case of failure"
|
echo " retry retry removal several times in case of failure"
|
||||||
echo " force force device removal"
|
echo " force force device removal"
|
||||||
echo " LVM_OPTIONS:"
|
echo " LVM_OPTIONS:"
|
||||||
echo " retry retry removal several times in case of failure"
|
echo " retry retry removal several times in case of failure"
|
||||||
echo " wholevg deactivate the whole VG when processing an LV"
|
echo " wholevg deactivate the whole VG when processing an LV"
|
||||||
|
echo " MPATH_OPTIONS:"
|
||||||
|
echo " disablequeueing disable queueing on all DM-multipath devices first"
|
||||||
|
|
||||||
exit
|
exit
|
||||||
}
|
}
|
||||||
@ -312,6 +320,11 @@ deactivate_all() {
|
|||||||
|
|
||||||
echo "Deactivating block devices:"
|
echo "Deactivating block devices:"
|
||||||
|
|
||||||
|
test $MPATHD_RUNNING -eq 1 && {
|
||||||
|
echo -n " [DM]: disabling queueing on all multipath devices... "
|
||||||
|
eval $MPATHD $MPATHD_OPTS disablequeueing maps $ERR | grep '^ok$' >$DEV_DIR/null && echo "done" || echo "failed"
|
||||||
|
}
|
||||||
|
|
||||||
if test $# -eq 0; then
|
if test $# -eq 0; then
|
||||||
#######################
|
#######################
|
||||||
# Process all devices #
|
# Process all devices #
|
||||||
@ -406,6 +419,20 @@ get_lvmopts() {
|
|||||||
IFS=$ORIG_IFS
|
IFS=$ORIG_IFS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_mpathopts() {
|
||||||
|
ORIG_IFS=$IFS; IFS=','
|
||||||
|
|
||||||
|
for opt in $1; do
|
||||||
|
case "$opt" in
|
||||||
|
"") ;;
|
||||||
|
"disablequeueing") MPATHD_DO_DISABLEQUEUEING=1 ;;
|
||||||
|
*) echo "$opt: unknown DM-multipath option"
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
IFS=$ORIG_IFS
|
||||||
|
}
|
||||||
|
|
||||||
set_env() {
|
set_env() {
|
||||||
if test "$ERRORS" -eq "1"; then
|
if test "$ERRORS" -eq "1"; then
|
||||||
unset ERR
|
unset ERR
|
||||||
@ -419,6 +446,7 @@ set_env() {
|
|||||||
DMSETUP_OPTS+="-vvvv"
|
DMSETUP_OPTS+="-vvvv"
|
||||||
LVM_OPTS+="-vvvv"
|
LVM_OPTS+="-vvvv"
|
||||||
MDADM_OPTS+="-vv"
|
MDADM_OPTS+="-vv"
|
||||||
|
MPATHD_OPTS+="-v 3"
|
||||||
else
|
else
|
||||||
OUT="1>$DEV_DIR/null"
|
OUT="1>$DEV_DIR/null"
|
||||||
fi
|
fi
|
||||||
@ -434,6 +462,15 @@ set_env() {
|
|||||||
else
|
else
|
||||||
MDADM_AVAILABLE=0
|
MDADM_AVAILABLE=0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
MPATHD_RUNNING=0
|
||||||
|
test $MPATHD_DO_DISABLEQUEUEING -eq 1 && {
|
||||||
|
if test -f $MPATHD; then
|
||||||
|
if eval $MPATHD show daemon $ERR | grep "running" >$DEVDIR/null; then
|
||||||
|
MPATHD_RUNNING=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while test $# -ne 0; do
|
while test $# -ne 0; do
|
||||||
@ -443,6 +480,7 @@ while test $# -ne 0; do
|
|||||||
"-h"|"--help") usage ;;
|
"-h"|"--help") usage ;;
|
||||||
"-d"|"--dmoption ") get_dmopts "$2" ; shift ;;
|
"-d"|"--dmoption ") get_dmopts "$2" ; shift ;;
|
||||||
"-l"|"--lvmoption ") get_lvmopts "$2" ; shift ;;
|
"-l"|"--lvmoption ") get_lvmopts "$2" ; shift ;;
|
||||||
|
"-m"|"--mpathoption ") get_mpathopts "$2" ; shift ;;
|
||||||
"-u"|"--umount") DO_UMOUNT=1 ;;
|
"-u"|"--umount") DO_UMOUNT=1 ;;
|
||||||
"-v"|"--verbose") VERBOSE=1 ; ERRORS=1 ;;
|
"-v"|"--verbose") VERBOSE=1 ; ERRORS=1 ;;
|
||||||
"-vv") VERBOSE=1 ; ERRORS=1 ; set -x ;;
|
"-vv") VERBOSE=1 ; ERRORS=1 ; set -x ;;
|
||||||
|
Loading…
Reference in New Issue
Block a user