[PATCH 2/3] btrfs: keep sysfs target add in the last

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.jain@xxxxxxxxxx>
---
 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 majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux