summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/sysfs.c
diff options
context:
space:
mode:
authorAnand Jain <anand.jain@oracle.com>2020-09-05 01:34:28 +0800
committerDavid Sterba <dsterba@suse.com>2020-10-07 12:12:21 +0200
commit30b0e4e0e3f53944755257c7d02792ee7f9c072e (patch)
treed2fb1221d73d8811194902678c06050f72fd7647 /fs/btrfs/sysfs.c
parent53f8a74cbeffd45a95de5dc6d16584aadb682a31 (diff)
btrfs: initialize sysfs devid and device link for seed device
We don't initialize the sysfs devid kobject and device-link yet for the seed devices in an sprouted filesystem. So this patch initializes the seed device devid kobject and the device link in the sysfs. Signed-off-by: Anand Jain <anand.jain@oracle.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/sysfs.c')
-rw-r--r--fs/btrfs/sysfs.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 7aed0712f183..f66632fefe0a 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -975,9 +975,15 @@ void btrfs_sysfs_remove_fsid(struct btrfs_fs_devices *fs_devs)
static void btrfs_sysfs_remove_fs_devices(struct btrfs_fs_devices *fs_devices)
{
struct btrfs_device *device;
+ struct btrfs_fs_devices *seed;
list_for_each_entry(device, &fs_devices->devices, dev_list)
btrfs_sysfs_remove_device(device);
+
+ list_for_each_entry(seed, &fs_devices->seed_list, seed_list) {
+ list_for_each_entry(device, &seed->devices, dev_list)
+ btrfs_sysfs_remove_device(device);
+ }
}
void btrfs_sysfs_remove_mounted(struct btrfs_fs_info *fs_info)
@@ -1351,6 +1357,7 @@ static int btrfs_sysfs_add_fs_devices(struct btrfs_fs_devices *fs_devices)
{
int ret;
struct btrfs_device *device;
+ struct btrfs_fs_devices *seed;
list_for_each_entry(device, &fs_devices->devices, dev_list) {
ret = btrfs_sysfs_add_device(device);
@@ -1358,6 +1365,14 @@ static int btrfs_sysfs_add_fs_devices(struct btrfs_fs_devices *fs_devices)
return ret;
}
+ list_for_each_entry(seed, &fs_devices->seed_list, seed_list) {
+ list_for_each_entry(device, &seed->devices, dev_list) {
+ ret = btrfs_sysfs_add_device(device);
+ if (ret)
+ return ret;
+ }
+ }
+
return 0;
}