btrfs-progs: add strdup in btrfs_add_to_fsid() to track the device path
authorGoffredo Baroncelli <kreijack@gmail.com>
Wed, 17 Dec 2014 20:14:08 +0000 (21:14 +0100)
committerDavid Sterba <dsterba@suse.cz>
Mon, 8 Jun 2015 15:50:46 +0000 (17:50 +0200)
When creating a new btrfs_device, copy the path to track it.  This path
is then used by mkfs.btrfs to list all devices.

Signed-off-by: Goffredo Baroncelli <kreijack@inwind.it>
Reviewed-by: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Signed-off-by: David Sterba <dsterba@suse.cz>
utils.c

diff --git a/utils.c b/utils.c
index 61a9cd9..ef27c51 100644 (file)
--- a/utils.c
+++ b/utils.c
@@ -750,6 +750,7 @@ int btrfs_add_to_fsid(struct btrfs_trans_handle *trans,
        device->bytes_used = 0;
        device->total_ios = 0;
        device->dev_root = root->fs_info->dev_root;
+       device->name = strdup(path);
 
        ret = btrfs_add_device(trans, root, device);
        BUG_ON(ret);