mirror of
https://github.com/ibm-s390-linux/s390-tools.git
synced 2026-08-05 02:14:52 +00:00
chreipl_helper.device-mapper: complete device resolution process
This fixes 670bf3e8 which actually isn't an equivalent refactoring.
The generic dm-device resolution procedure was modified to not resolve
the topmost dm-device in the path. So that any calles who don't expect
it, should complete the resolutioin process by themselves. In case of
chreipl_helper such completion was missed. chreipl(8) utility doesn't
expect dm-devices at the output of chreipl_helper.device-mapper
Example:
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 20G 0 disk
|-sda1 8:1 0 20G 0 part
`-mpathb 253:0 0 20G 0 mpath
`-mpathb1 253:2 0 20G 0 part /
sdb 8:16 0 20G 0 disk
|-sdb1 8:17 0 20G 0 part
`-mpathb 253:0 0 20G 0 mpath
`-mpathb1 253:2 0 20G 0 part /
Expected result:
8:16
Actual result:
253:0
As a result, the chreipl(8) "node" option stopped working.
The fixup adds the completion.
Reported-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Eduard Shishkin <edward6@linux.ibm.com>
Tested-by: Alexander Egorenkov <egorenar@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
committed by
Jan Höppner
parent
fe2d240656
commit
e09753f2a3
@@ -19,7 +19,7 @@
|
||||
* device-mapper table for this device conforms to the following rules:
|
||||
* - directory is located on a device consisting of a single device-mapper
|
||||
* target
|
||||
* - only linear, mirror and multipath targets are supported
|
||||
* - only linear, multipath, mirror and raid targets are supported
|
||||
* - supported physical device types are DASD and SCSI devices
|
||||
* - all of the device which contains the directory must be located on a single
|
||||
* physical device (which may be mirrored or accessed through a multipath
|
||||
@@ -1179,6 +1179,11 @@ static struct util_list *dmpath_walk(struct ext_dev *bottom, const char *dir,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
* In case of success PD contains a dmpath. The topmost target of that
|
||||
* dmpath is a dm-device. So, any callers who don't expect it, should
|
||||
* complete the resolution process by themselves
|
||||
*/
|
||||
static int get_physical_device(struct physical_device *pd, struct ext_dev *dev,
|
||||
const char *dir)
|
||||
{
|
||||
@@ -1401,7 +1406,13 @@ static int dm_dev_to_chreipl_params(dev_t dev, char *dir)
|
||||
|
||||
if (get_physical_device(&pd, &xdev, dir))
|
||||
return -1;
|
||||
top_dev = get_top_entry(&pd)->dev.dev;
|
||||
/*
|
||||
* chreipl(8) utility doesn't expect dm-device at the
|
||||
* chreipl_helper output. So, complete the resolution
|
||||
* process (see the comment to get_physical_device)
|
||||
*/
|
||||
top_dev = first_device_by_target_data(get_top_entry(&pd)->target);
|
||||
|
||||
printf("%u:%u\n", major(top_dev), minor(top_dev));
|
||||
dmpath_free(pd.dmpath);
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user