Skip to content

Commit 7af30ba

Browse files
adam900710morbidrsa
authored andcommitted
btrfs: print a message when a missing device re-appears
There is a bug report that fstrim crashed, and that crash is eventually pinned down to a missing device which re-appeared and screwed up callers that only checks BTRFS_DEV_STATE_MISSING, but not BTRFS_DEV_STATE_WRITEABLE nor device->bdev. A missing device re-appearing can be very tricky, as for now it will result in a device without WRITEABLE or MISSING flag, and still no bdev pointer. As the first step to enhance handling of such re-appearing missing devices, add a dmesg output when a missing device re-appeared. Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Qu Wenruo <wqu@suse.com> Signed-off-by: David Sterba <dsterba@suse.com>
1 parent 1b1937e commit 7af30ba

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

fs/btrfs/volumes.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,11 @@ static noinline struct btrfs_device *device_list_add(const char *path,
963963
devid, btrfs_dev_name(device),
964964
path, current->comm,
965965
task_pid_nr(current));
966+
} else {
967+
btrfs_info(NULL,
968+
"missing devid %llu re-appeared at %s scanned by %s (%d)",
969+
devid, path, current->comm,
970+
task_pid_nr(current));
966971
}
967972

968973
name = kstrdup(path, GFP_NOFS);

0 commit comments

Comments
 (0)