btrfs-progs: add strdup in btrfs_add_to_fsid() to track the device path

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>
master
Goffredo Baroncelli 2014-12-17 21:14:08 +01:00 committed by David Sterba
parent 1bcedaae79
commit b96345c7ff
1 changed files with 1 additions and 0 deletions

View File

@ -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);