.RB [ \-e ]
.RB [ \-h ]
.RB [ \-l \ \fIlvm_options\fP ]
+.RB [ \-m \ \fImpath_options\fP ]
.RB [ \-u ]
.RB [ \-v ]
.RI [ device ]
Logical Volume separately.
.RE
.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
Unmount a mounted device before trying to deactivate it.
Without this option used, a device that is mounted is not deactivated.
.BR lsblk (8),
.BR lvm (8),
.BR mdadm (8),
+.BR multipathd (8),
.BR umount (8)
DMSETUP="@sbindir@/dmsetup"
LVM="@sbindir@/lvm"
MDADM="@sbindir@/mdadm"
+MPATHD="/sbin/multipathd"
if $UMOUNT --help | grep -- "--all-targets" >$DEV_DIR/null; then
UMOUNT_OPTS="--all-targets "
DMSETUP_OPTS=""
LVM_OPTS=""
MDADM_OPTS=""
+MPATHD_OPTS=""
LSBLK="/bin/lsblk -r --noheadings -o TYPE,KNAME,NAME,MOUNTPOINT"
LSBLK_VARS="local devtype local kname local name local mnt"
# Do not retry LV deactivation by default.
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.
# Device name is the KNAME from lsblk output.
echo " If devices are specified, deactivate only supplied devices and their holders."
echo
echo " Options:"
- echo " -e | --errors Show errors reported from tools"
- echo " -h | --help Show this help message"
- echo " -d | --dmoption DM_OPTIONS Comma separated DM specific options"
- echo " -l | --lvmoption LVM_OPTIONS Comma separated LVM specific options"
- echo " -u | --umount Unmount the device if mounted"
- echo " -v | --verbose Verbose mode (also implies -e)"
+ echo " -e | --errors Show errors reported from tools"
+ echo " -h | --help Show this help message"
+ echo " -d | --dmoption DM_OPTIONS Comma separated DM specific options"
+ echo " -l | --lvmoption LVM_OPTIONS Comma separated LVM specific options"
+ echo " -m | --mpathoption MPATH_OPTIONS Comma separated DM-multipath specific options"
+ echo " -u | --umount Unmount the device if mounted"
+ echo " -v | --verbose Verbose mode (also implies -e)"
echo
echo " Device specific options:"
echo " DM_OPTIONS:"
- echo " retry retry removal several times in case of failure"
- echo " force force device removal"
+ echo " retry retry removal several times in case of failure"
+ echo " force force device removal"
echo " LVM_OPTIONS:"
- echo " retry retry removal several times in case of failure"
- echo " wholevg deactivate the whole VG when processing an LV"
+ echo " retry retry removal several times in case of failure"
+ echo " wholevg deactivate the whole VG when processing an LV"
+ echo " MPATH_OPTIONS:"
+ echo " disablequeueing disable queueing on all DM-multipath devices first"
exit
}
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
#######################
# Process all devices #
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() {
if test "$ERRORS" -eq "1"; then
unset ERR
DMSETUP_OPTS+="-vvvv"
LVM_OPTS+="-vvvv"
MDADM_OPTS+="-vv"
+ MPATHD_OPTS+="-v 3"
else
OUT="1>$DEV_DIR/null"
fi
else
MDADM_AVAILABLE=0
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
"-h"|"--help") usage ;;
"-d"|"--dmoption ") get_dmopts "$2" ; shift ;;
"-l"|"--lvmoption ") get_lvmopts "$2" ; shift ;;
+ "-m"|"--mpathoption ") get_mpathopts "$2" ; shift ;;
"-u"|"--umount") DO_UMOUNT=1 ;;
"-v"|"--verbose") VERBOSE=1 ; ERRORS=1 ;;
"-vv") VERBOSE=1 ; ERRORS=1 ; set -x ;;