When using fence_scsi with multipath devices and specifying a "devices" attribute in RHEL, reservation conflicts are logged
Environment
- Red Hat Enterprise Linux Server 6, 7, 8, 9 (with the High Availability Add On)
fence_scsi- The shared storage uses device mapper multipath (dmm)
Issue
- During some cluster test we have seen some entries in the log file that need our attention:
Feb 11 19:43:48 node2 kernel: sd 2:0:2:6: [sdh] Result: hostbyte=DID_OK driverbyte=DRIVER_OK
Feb 11 19:43:48 node2 kernel: sd 2:0:2:6: [sdh] CDB: Write(10): 2a 00 42 87 08 00 00 04 00 00
Feb 11 19:43:48 node2 kernel: sd 2:0:2:6: reservation conflict
Feb 11 19:43:48 node2 kernel: end_request: critical nexus error, dev sdh, sector 1116147712
- We have configured the
fence_scsito be used as fencing device for this multipathed device but we get reservation conflicts:
<fencedevice agent="fence_scsi" name="scsi_node1" devices="/dev/disk/by-id/scsi-3600c0ff00013e0bef982e94f01000000"/>
<fencedevice agent="fence_scsi" name="scsi_node2" devices="/dev/disk/by-id/scsi-3600c0ff00013e0bef982e94f01000000"/>
Resolution
RHEL 6 or later pacemaker based cluster
Change the `devices` attribute on the `fence_scsi` stonith device to point to the multipath device instead of the physical disk. Follow the solution outlined in the article: [Can I add or remove devices to a fence_scsi or fence_mpath device without restarting the cluster or all the resources?](/solutions/4526971)
For example, instead of having paths to the physical devices in the devices attribute you would use the path to the multipath device in the devices attribute:
- /dev/mapper/mpatha
- /dev/disk/by-id/scsi-3600a09803830472f632b4e44787XXXXX
- /dev/disk/by-id/dm-uuid-mpath-3600a09803830472f632b4e44787XXXXX
Related Articles
- Support Policies for RHEL High Availability Clusters - fence_scsi and fence_mpath
- Using SCSI Persistent Reservation Fencing (
fence_scsi) with pacemaker in a Red Hat High Availability cluster - How to setup/create/configure
fence_mpath? - Can I add or remove devices to a fence_scsi or fence_mpath device without restarting the cluster or all the resources?
RHEL 6 CMAN based cluster
Implement one of the following solutions:
- If all shared storage devices in the cluster are physical volumes in clustered volume groups, then remove the
devicesattribute altogether. For example:
<fencedevice agent="fence_scsi" name="scsi_node2"/>
fence_scsi is capable of detecting the proper devices by determining the physical volumes for any clustered volume groups. This detection will properly use the path to the multipath device, as opposed to the underlying paths.
OR
- Change the
devicesattribute on thefence_scsi fencedevicein/etc/cluster/cluster.confto point to the multipath device instead of symlink or physical disk. For example:
<fencedevice agent="fence_scsi" name="scsi_node2" devices="/dev/mapper/mpathb, /dev/disk/by-id/scsi-360014380125989a100005000001a0000"/>
or
<fencedevice agent="fence_scsi" name="scsi_node2" devices="/dev/disk/by-id/dm-uuid-mpath-3600XXXX, /dev/disk/by-id/dm-uuid-mpath-360014380125989a100005000001a0000"/>
OR
Remove the fence_scsi fence/stonith device from your configuration and use fence_mpath instead.
- Support Policies for RHEL High Availability Clusters -
fence_scsiandfence_mpath - How to setup/create/configure
fence_mpath
Root Cause
If specifying a value for the devices attribute of fence_scsi, and device-mapper-multipath is in use, devices must specify the path to the multipath device, not one of the underlying slaves. Alternatively, the devices attribute can be left off, allowing fence_scsi to automatically determine which devices are to be reserved/registered based on whether they are physical volumes in clustered volume groups. This detection will use the multipath device, and not underlying paths.
Otherwise all individual paths will not be registered properly, and I/O sent to individual paths may generate SCSI reservation conflicts.
For more information please refer to the 'Diagnostic Steps' section and knowledge base article Udev's block device setups which generate /dev/disk/* should link to /dev/mpath/mpath*, not the underlying /dev/sd* units..
Diagnostic Steps
Verifying the source code of fence_scsi to see how fence_scsi will register to the multipath devices.
From the do_register function, we see the following:
- The parameters for do_register are
$host_key,$node_keyand the device$dev
sub do_register ($$$)
{
my $self = (caller(0))[3];
my ($host_key, $node_key, $dev) = @_;
$dev = realpath ($dev);
...
- the
realpathof$devis evaluated. What is the return of realpath? From Content from perldoc.perl.org is not included.perldoc it is doing the same as abs_path
* abs_path
my $abs_path = abs_path($file);
Uses the same algorithm as getcwd(). Symbolic links and relative-path components ("." and "..") are resolved to
return the canonical pathname, just like realpath(3).
- But fence_scsi do only evaluate the multipath slaves when the result of
$devdo start withdmat the 5th position it checks the paths
if (substr ($dev, 5) =~ /^dm/) {
my @slaves = get_mpath_slaves ($dev);
foreach (@slaves) {
do_register ($node_key, $_);
}
return;
}
With this information the fence_scsi devices are not configured correct as e.g. '/dev/disk/by-id/scsi-3600c0ff00013e0bead82e94f01000000' is a link to a /dev/sdX device.
Verifying this on a lab machine with the following multipath device configuration:
# multipath -ll
mpathb (3600508b300922b100c22b811acf50004) dm-1 HP,MSA VOLUME
size=70G features='1 queue_if_no_path' hwhandler='0' wp=rw
|-+- policy='round-robin 0' prio=50 status=active
| |- 2:0:1:1 sdc 8:32 active ready running
| `- 3:0:1:1 sdg 8:96 active ready running
`-+- policy='round-robin 0' prio=10 status=enabled
|- 2:0:0:1 sda 8:0 active ready running
`- 3:0:0:1 sde 8:64 active ready running
/dev/disk/by-id/scsi-3600508b300922b100c22b811acf50004 is a link to /dev/sda
# ll /dev/disk/by-id/scsi-3600508b300922b100c22b811acf50004
lrwxrwxrwx. 1 root root 9 Feb 20 16:59 /dev/disk/by-id/scsi-3600508b300922b100c22b811acf50004 -> ../../sda
With the following perl we can check what is the result of realpath
#!/usr/bin/perl
use Cwd 'realpath';
use File::Basename;
use File::Path;
use Getopt::Std;
use POSIX;
$dev='</dev/disk/by-id/XXXX-3600508b300922b100c22b811acf50004';
$dev = realpath ($dev);
printf $dev;
Running this two times with the following devices:
$dev='/dev/disk/by-id/scsi-3600508b300922b100c22b811acf50004':
# perl fence_scsi_devices.pl
/dev/sda
$dev='/dev/disk/by-id/dm-uuid-mpath-3600508b300922b100c22b811acf50004':
# perl fence_scsi_devices.pl
/dev/dm-1
With all this information we need to change the fence_scsi devices
from:
* /dev/disk/by-id/scsi-3600XXXX
to:
* /dev/disk/by-id/dm-uuid-mpath-3600XXXX
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.