Re: [PATCH] btrfs: harden identification of the stale device
From: Anand Jain <hidden>
Date: 2021-12-10 12:54:25
On 08/12/2021 22:29, Josef Bacik wrote:
On Wed, Dec 08, 2021 at 10:05:29PM +0800, Anand Jain wrote:quoted
Identifying and removing the stale device from the fs_uuids list is done by the function btrfs_free_stale_devices(). btrfs_free_stale_devices() in turn depends on the function device_path_matched() to check if the device repeats in more than one btrfs_device structure. The matching of the device happens by its path, the device path. However, when dm mapper is in use, the dm device paths are nothing but a link to the actual block device, which leads to the device_path_matched() failing to match. Fix this by matching the dev_t as provided by lookup_bdev() instead of plain strcmp() the device paths. Reported-by: Josef Bacik <josef@toxicpanda.com> Signed-off-by: Anand Jain <redacted>We already have the bdev for the device in most of the callers here, the only exception is btrfs_forget_devices. Can we change this up to pass in the dev_t of the device we're trying to remove, that way we don't have to do the lookup over and over for the path of the device we're trying to forget? Thanks,
Right. I have made the related changes and, in v2, this change is on top of this patch. Thanks, Anand
Josef