Remove unnecessary references to slavery
The horrible effects of human slavery continue to impact society. The casual use of the term "slave" in computer software is an unnecessary reference to a painful human experience. This commit removes all possible references to the term "slave". Implementation notes: The zpool.d/slaves script is renamed to dm-deps, which uses the same terminology as `dmsetup deps`. References to the `/sys/class/block/$dev/slaves` directory remain. This directory name is determined by the Linux kernel. Although `dmsetup deps` provides the same information, it unfortunately requires elevated privileges, whereas the `/sys/...` directory is world-readable. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Matthew Ahrens <mahrens@delphix.com> Closes #10435
This commit is contained in:
parent
feff3f69fc
commit
f66434268c
|
@ -36,6 +36,7 @@ zpoolexecdir = $(zfsexecdir)/zpool.d
|
||||||
EXTRA_DIST = zpool.d/README
|
EXTRA_DIST = zpool.d/README
|
||||||
|
|
||||||
dist_zpoolexec_SCRIPTS = \
|
dist_zpoolexec_SCRIPTS = \
|
||||||
|
zpool.d/dm-deps \
|
||||||
zpool.d/enc \
|
zpool.d/enc \
|
||||||
zpool.d/encdev \
|
zpool.d/encdev \
|
||||||
zpool.d/fault_led \
|
zpool.d/fault_led \
|
||||||
|
@ -50,7 +51,6 @@ dist_zpoolexec_SCRIPTS = \
|
||||||
zpool.d/serial \
|
zpool.d/serial \
|
||||||
zpool.d/ses \
|
zpool.d/ses \
|
||||||
zpool.d/size \
|
zpool.d/size \
|
||||||
zpool.d/slaves \
|
|
||||||
zpool.d/slot \
|
zpool.d/slot \
|
||||||
zpool.d/smart \
|
zpool.d/smart \
|
||||||
zpool.d/smartx \
|
zpool.d/smartx \
|
||||||
|
@ -80,6 +80,7 @@ dist_zpoolexec_SCRIPTS = \
|
||||||
zpool.d/test_ended
|
zpool.d/test_ended
|
||||||
|
|
||||||
zpoolconfdefaults = \
|
zpoolconfdefaults = \
|
||||||
|
dm-deps \
|
||||||
enc \
|
enc \
|
||||||
encdev \
|
encdev \
|
||||||
fault_led \
|
fault_led \
|
||||||
|
@ -94,7 +95,6 @@ zpoolconfdefaults = \
|
||||||
serial \
|
serial \
|
||||||
ses \
|
ses \
|
||||||
size \
|
size \
|
||||||
slaves \
|
|
||||||
slot \
|
slot \
|
||||||
smart \
|
smart \
|
||||||
smartx \
|
smartx \
|
||||||
|
|
|
@ -1,14 +1,11 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# Show device mapper slave devices. This is useful for looking up the
|
# Show device mapper dependent / underlying devices. This is useful for
|
||||||
# /dev/sd* devices associated with a dm or multipath device. For example:
|
# looking up the /dev/sd* devices associated with a dm or multipath device.
|
||||||
#
|
|
||||||
# $ ls /sys/block/dm-113/slaves/
|
|
||||||
# sddt sdjw
|
|
||||||
#
|
#
|
||||||
|
|
||||||
if [ "$1" = "-h" ] ; then
|
if [ "$1" = "-h" ] ; then
|
||||||
echo "Show device mapper slave devices."
|
echo "Show device mapper dependent (underlying) devices."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -29,4 +26,4 @@ if [ -d "/sys/class/block/$dev/slaves" ] ; then
|
||||||
val=$(echo "$val" | sed -r 's/[[:blank:]]+/ /g')
|
val=$(echo "$val" | sed -r 's/[[:blank:]]+/ /g')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "slaves=$val"
|
echo "dm-deps=$val"
|
|
@ -74,10 +74,10 @@ check() {
|
||||||
local blockdevs
|
local blockdevs
|
||||||
local fstype
|
local fstype
|
||||||
local majmin
|
local majmin
|
||||||
local _slavedev
|
local _depdev
|
||||||
local _slavedevname
|
local _depdevname
|
||||||
local _slavedevtype
|
local _depdevtype
|
||||||
local _slavemajmin
|
local _depmajmin
|
||||||
local _dev
|
local _dev
|
||||||
|
|
||||||
if [[ $hostonly ]]; then
|
if [[ $hostonly ]]; then
|
||||||
|
@ -108,15 +108,15 @@ if [[ $hostonly ]]; then
|
||||||
host_fs_types["$dev"]="$fstype"
|
host_fs_types["$dev"]="$fstype"
|
||||||
majmin=$(get_maj_min "$dev")
|
majmin=$(get_maj_min "$dev")
|
||||||
if [[ -d /sys/dev/block/$majmin/slaves ]] ; then
|
if [[ -d /sys/dev/block/$majmin/slaves ]] ; then
|
||||||
for _slavedev in /sys/dev/block/$majmin/slaves/*; do
|
for _depdev in /sys/dev/block/$majmin/slaves/*; do
|
||||||
[[ -f $_slavedev/dev ]] || continue
|
[[ -f $_depdev/dev ]] || continue
|
||||||
_slavedev=/dev/$(basename "$_slavedev")
|
_depdev=/dev/$(basename "$_depdev")
|
||||||
_slavedevname=$(udevadm info --query=property --name="$_slavedev" | grep "^DEVNAME=" | sed 's|^DEVNAME=||')
|
_depdevname=$(udevadm info --query=property --name="$_depdev" | grep "^DEVNAME=" | sed 's|^DEVNAME=||')
|
||||||
_slavedevtype=$(get_devtype "$_slavedevname")
|
_depdevtype=$(get_devtype "$_depdevname")
|
||||||
_slavemajmin=$(get_maj_min "$_slavedevname")
|
_depmajmin=$(get_maj_min "$_depdevname")
|
||||||
dinfo "zfsexpandknowledge: slave block device backing ZFS dataset $mp: $_slavedevname"
|
dinfo "zfsexpandknowledge: underlying block device backing ZFS dataset $mp: $_depdevname"
|
||||||
array_contains "$_slavedevname" "${host_devs[@]}" || host_devs+=("$_slavedevname")
|
array_contains "$_depdevname" "${host_devs[@]}" || host_devs+=("$_depdevname")
|
||||||
host_fs_types["$_slavedevname"]="$_slavedevtype"
|
host_fs_types["$_depdevname"]="$_depdevtype"
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
@ -69,7 +69,6 @@ struct dk_cinfo {
|
||||||
uint_t dki_vec; /* interrupt vector */
|
uint_t dki_vec; /* interrupt vector */
|
||||||
char dki_dname[DK_DEVLEN]; /* drive name (no unit #) */
|
char dki_dname[DK_DEVLEN]; /* drive name (no unit #) */
|
||||||
uint_t dki_unit; /* unit number */
|
uint_t dki_unit; /* unit number */
|
||||||
uint_t dki_slave; /* slave number */
|
|
||||||
ushort_t dki_partition; /* partition number */
|
ushort_t dki_partition; /* partition number */
|
||||||
ushort_t dki_maxtransfer; /* max. transfer size in DEV_BSIZE */
|
ushort_t dki_maxtransfer; /* max. transfer size in DEV_BSIZE */
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,7 +59,6 @@ struct dk_cinfo {
|
||||||
uint_t dki_vec; /* interrupt vector */
|
uint_t dki_vec; /* interrupt vector */
|
||||||
char dki_dname[DK_DEVLEN]; /* drive name (no unit #) */
|
char dki_dname[DK_DEVLEN]; /* drive name (no unit #) */
|
||||||
uint_t dki_unit; /* unit number */
|
uint_t dki_unit; /* unit number */
|
||||||
uint_t dki_slave; /* slave number */
|
|
||||||
ushort_t dki_partition; /* partition number */
|
ushort_t dki_partition; /* partition number */
|
||||||
ushort_t dki_maxtransfer; /* max. transfer size in DEV_BSIZE */
|
ushort_t dki_maxtransfer; /* max. transfer size in DEV_BSIZE */
|
||||||
};
|
};
|
||||||
|
|
|
@ -203,7 +203,11 @@ dm_get_underlying_path(const char *dm_name)
|
||||||
if (dp == NULL)
|
if (dp == NULL)
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
/* Return first sd* entry in /sys/block/dm-N/slaves/ */
|
/*
|
||||||
|
* Return first entry (that isn't itself a directory) in the
|
||||||
|
* directory containing device-mapper dependent (underlying)
|
||||||
|
* devices.
|
||||||
|
*/
|
||||||
while ((ep = readdir(dp))) {
|
while ((ep = readdir(dp))) {
|
||||||
if (ep->d_type != DT_DIR) { /* skip "." and ".." dirs */
|
if (ep->d_type != DT_DIR) { /* skip "." and ".." dirs */
|
||||||
size = asprintf(&path, "/dev/%s", ep->d_name);
|
size = asprintf(&path, "/dev/%s", ep->d_name);
|
||||||
|
|
|
@ -431,18 +431,13 @@ option.
|
||||||
U13 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
|
U13 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
|
||||||
U14 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
|
U14 ONLINE 0 0 0 SEAGATE ST8000NM0075 7.3T
|
||||||
|
|
||||||
# zpool iostat -vc slaves
|
# zpool iostat -vc size
|
||||||
capacity operations bandwidth
|
capacity operations bandwidth
|
||||||
pool alloc free read write read write slaves
|
pool alloc free read write read write size
|
||||||
---------- ----- ----- ----- ----- ----- ----- ---------
|
---------- ----- ----- ----- ----- ----- ----- ----
|
||||||
tank 20.4G 7.23T 26 152 20.7M 21.6M
|
rpool 14.6G 54.9G 4 55 250K 2.69M
|
||||||
mirror 20.4G 7.23T 26 152 20.7M 21.6M
|
sda1 14.6G 54.9G 4 55 250K 2.69M 70G
|
||||||
U1 - - 0 31 1.46K 20.6M sdb sdff
|
---------- ----- ----- ----- ----- ----- ----- ----
|
||||||
U10 - - 0 1 3.77K 13.3K sdas sdgw
|
|
||||||
U11 - - 0 1 288K 13.3K sdat sdgx
|
|
||||||
U12 - - 0 1 78.4K 13.3K sdau sdgy
|
|
||||||
U13 - - 0 1 128K 13.3K sdav sdgz
|
|
||||||
U14 - - 0 1 63.2K 13.3K sdfk sdg
|
|
||||||
.Ed
|
.Ed
|
||||||
.El
|
.El
|
||||||
.Sh ENVIRONMENT VARIABLES
|
.Sh ENVIRONMENT VARIABLES
|
||||||
|
|
|
@ -336,25 +336,25 @@ function on_off_disk # disk state{online,offline} host
|
||||||
if [[ $state == "offline" ]] && ( is_mpath_device $disk ); then
|
if [[ $state == "offline" ]] && ( is_mpath_device $disk ); then
|
||||||
dm_name="$(readlink $DEV_DSKDIR/$disk \
|
dm_name="$(readlink $DEV_DSKDIR/$disk \
|
||||||
| nawk -F / '{print $2}')"
|
| nawk -F / '{print $2}')"
|
||||||
slave="$(ls /sys/block/${dm_name}/slaves \
|
dep="$(ls /sys/block/${dm_name}/slaves \
|
||||||
| nawk '{print $1}')"
|
| nawk '{print $1}')"
|
||||||
while [[ -n $slave ]]; do
|
while [[ -n $dep ]]; do
|
||||||
#check if disk is online
|
#check if disk is online
|
||||||
lsscsi | egrep $slave > /dev/null
|
lsscsi | egrep $dep > /dev/null
|
||||||
if (($? == 0)); then
|
if (($? == 0)); then
|
||||||
slave_dir="/sys/block/${dm_name}"
|
dep_dir="/sys/block/${dm_name}"
|
||||||
slave_dir+="/slaves/${slave}/device"
|
dep_dir+="/slaves/${dep}/device"
|
||||||
ss="${slave_dir}/state"
|
ss="${dep_dir}/state"
|
||||||
sd="${slave_dir}/delete"
|
sd="${dep_dir}/delete"
|
||||||
log_must eval "echo 'offline' > ${ss}"
|
log_must eval "echo 'offline' > ${ss}"
|
||||||
log_must eval "echo '1' > ${sd}"
|
log_must eval "echo '1' > ${sd}"
|
||||||
lsscsi | egrep $slave > /dev/null
|
lsscsi | egrep $dep > /dev/null
|
||||||
if (($? == 0)); then
|
if (($? == 0)); then
|
||||||
log_fail "Offlining" \
|
log_fail "Offlining" \
|
||||||
"$disk failed"
|
"$disk failed"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
slave="$(ls /sys/block/$dm_name/slaves \
|
dep="$(ls /sys/block/$dm_name/slaves \
|
||||||
2>/dev/null | nawk '{print $1}')"
|
2>/dev/null | nawk '{print $1}')"
|
||||||
done
|
done
|
||||||
elif [[ $state == "offline" ]] && ( is_real_device $disk ); then
|
elif [[ $state == "offline" ]] && ( is_real_device $disk ); then
|
||||||
|
@ -380,9 +380,9 @@ function on_off_disk # disk state{online,offline} host
|
||||||
if is_mpath_device $disk; then
|
if is_mpath_device $disk; then
|
||||||
dm_name="$(readlink $DEV_DSKDIR/$disk \
|
dm_name="$(readlink $DEV_DSKDIR/$disk \
|
||||||
| nawk -F / '{print $2}')"
|
| nawk -F / '{print $2}')"
|
||||||
slave="$(ls /sys/block/$dm_name/slaves \
|
dep="$(ls /sys/block/$dm_name/slaves \
|
||||||
| nawk '{print $1}')"
|
| nawk '{print $1}')"
|
||||||
lsscsi | egrep $slave > /dev/null
|
lsscsi | egrep $dep > /dev/null
|
||||||
if (($? != 0)); then
|
if (($? != 0)); then
|
||||||
log_fail "Onlining $disk failed"
|
log_fail "Onlining $disk failed"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue