Fix bug in DM iteration and standardise how to iterate through DM layers (#40426)
get_block_device_harder_fd() currently only traverses one level of device mapper stacking when looking for the underlying block device. This causes issues with nested DM setups like dm-crypt on top of dm-integrity, where we don't traverse enough to get the actual physical device. Fix this by iterating through all DM layers until we reach a device with no underlying device. And while we're at it also make cgroups use the same logic. Fixes: #40419
This commit is contained in:
+1
-2
@@ -973,8 +973,7 @@ static int lookup_block_device(const char *p, dev_t *ret) {
|
||||
}
|
||||
|
||||
/* If this is a LUKS/DM device, recursively try to get the originating block device */
|
||||
while (block_get_originating(*ret, ret) >= 0)
|
||||
;
|
||||
(void) block_get_originating(*ret, ret, /* recursive= */ true);
|
||||
|
||||
/* If this is a partition, try to get the originating block device */
|
||||
(void) block_get_whole_disk(*ret, ret);
|
||||
|
||||
Reference in New Issue
Block a user