Skip to content

Commit f2c3bec

Browse files
asjkdave
authored andcommitted
btrfs: add info when mount fails due to stale replace target
If the replace target device reappears after the suspended replace is cancelled, it blocks the mount operation as it can't find the matching replace-item in the metadata. As shown below, BTRFS error (device sda5): replace devid present without an active replace item To overcome this situation, the user can run the command btrfs device scan --forget <replace target device> and try the mount command again. And also, to avoid repeating the issue, superblock on the devid=0 must be wiped. wipefs -a device-path-to-devid=0. This patch adds some info when this situation occurs. Reported-by: Samuel Greiner <[email protected]> Link: https://lore.kernel.org/linux-btrfs/[email protected]/T/ CC: [email protected] # 5.0+ Signed-off-by: Anand Jain <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 59a3991 commit f2c3bec

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

fs/btrfs/dev-replace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ int btrfs_init_dev_replace(struct btrfs_fs_info *fs_info)
165165
*/
166166
if (btrfs_find_device(fs_info->fs_devices, &args)) {
167167
btrfs_err(fs_info,
168-
"replace devid present without an active replace item");
168+
"replace without active item, run 'device scan --forget' on the target device");
169169
ret = -EUCLEAN;
170170
} else {
171171
dev_replace->srcdev = NULL;

0 commit comments

Comments
 (0)