Sysfs create context should come in the last, so that we don't have to undo sysfs operation for the reason that any other operation has failed.
Signed-off-by: Anand Jain <anand.j...@oracle.com> --- fs/btrfs/dev-replace.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/fs/btrfs/dev-replace.c b/fs/btrfs/dev-replace.c index d38cad37ba27..025f42ef5ab3 100644 --- a/fs/btrfs/dev-replace.c +++ b/fs/btrfs/dev-replace.c @@ -397,10 +397,6 @@ int btrfs_dev_replace_start(struct btrfs_root *root, args->result = BTRFS_IOCTL_DEV_REPLACE_RESULT_NO_ERROR; btrfs_dev_replace_unlock(dev_replace, 1); - ret = btrfs_sysfs_add_device_link(tgt_device->fs_devices, tgt_device); - if (ret) - btrfs_err(fs_info, "kobj add dev failed %d\n", ret); - btrfs_wait_ordered_roots(fs_info, -1); /* force writing the updated state information to disk */ @@ -428,6 +424,9 @@ int btrfs_dev_replace_start(struct btrfs_root *root, WARN_ON(ret); } + if (btrfs_sysfs_add_device_link(tgt_device->fs_devices, tgt_device)) + btrfs_err(fs_info, "kobj add dev failed during replace\n"); + return ret; leave: -- 2.7.0 -- To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html