You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
btrfs-progs: replace: fix an unexpected new line when replace failed
[BUG]
When a device replace failed, e.g. try to replace a device on a RO
mounted btrfs, the error message is incorrectly broken into two lines:
[adam@btrfs-vm ~]$ sudo btrfs replace start -fB 1 /dev/test/scratch3 /mnt/btrfs/
Performing full device TRIM /dev/mapper/test-scratch3 (10.00GiB) ...
ERROR: ioctl(DEV_REPLACE_START) failed on "/mnt/btrfs/": Read-only file system
[adam@btrfs-vm ~]$
Note the newline after the "Read-only file system" error message.
[CAUSE]
Inside cmd_replace_start(), if the ioctl failed we need to handle the
error messages different depeneding on start_args.result.
If the result is not BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_RESULT we will
append extra info to the error message.
But the initial error message is using error(), which implies a newline.
This results the above incorrectly splitted error message.
[FIX]
Instead of manually appending an extra reason to the existing error
message, just do different output depending on the start_args.result in
the first place.
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
0 commit comments