Skip to contentSkip to conversation

btrfs: sysfs: check initialization state before updating features

PATCH Superseded David Sterba 4 participants 5 messages Jan 27, 2016 Btrfs file system

lore
Share & tools
lore

David Sterba

author maintainer
#0 lore raw

PATCH 1/1 btrfs: sysfs: check initialization state before updating features

If the mount phase is not finished, we can't update the sysfs files.

---
 fs/btrfs/sysfs.c | 3 +++
 1 file changed, 3 insertions(+)
fs/btrfs/sysfs.c +3 -0
index 6986886243bf..1ae146a8093c 100644
@@ -804,6 +804,9 @@ void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,
 	fs_devs = fs_info->fs_devices;
 	fsid_kobj = &fs_devs->fsid_kobj;
 
+	if (!fsid_kobj.state_initialized)
+		return;
+
 	/*
 	 * FIXME: this is too heavy to update just one value, ideally we'd like
 	 * to use sysfs_update_group but some refactoring is needed first.
Signature · 1 line
1.8.4.5
#1 lore raw
Quoted 13 lines · David Sterba

If the mount phase is not finished, we can't update the sysfs files.

---
 fs/btrfs/sysfs.c | 3 +++
 1 file changed, 3 insertions(+)
fs/btrfs/sysfs.c +0 -0
index 6986886243bf..1ae146a8093c 100644

fs/btrfs/sysfs.c void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info, · line 809

Quoted 6 lines
fs/btrfs/sysfs.c +3 -0
@@ -804,6 +804,9 @@ void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,
        fs_devs = fs_info->fs_devices;
        fsid_kobj = &fs_devs->fsid_kobj;
 
+       if (!fsid_kobj.state_initialized)
+               return;
+

uhm..

fs/btrfs/sysfs.c: In function 'btrfs_sysfs_feature_update':
fs/btrfs/sysfs.c:807:16: error: request for member 'state_initialized' in something not a structure or union
if (!fsid_kobj.state_initialized)

                ^

I think this should be fsid_kobj->state_initialized, no?

-h

#2 lore raw
Quoted 23 lines · Holger Hoffstätte
Quoted 13 lines · David Sterba

If the mount phase is not finished, we can't update the sysfs files.

---
 fs/btrfs/sysfs.c | 3 +++
 1 file changed, 3 insertions(+)
fs/btrfs/sysfs.c +0 -0
index 6986886243bf..1ae146a8093c 100644

fs/btrfs/sysfs.c void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info, · line 809

Quoted 6 lines
fs/btrfs/sysfs.c +3 -0
@@ -804,6 +804,9 @@ void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,
        fs_devs = fs_info->fs_devices;
        fsid_kobj = &fs_devs->fsid_kobj;
 
+       if (!fsid_kobj.state_initialized)
+               return;
+

uhm..

Quoted 7 lines

fs/btrfs/sysfs.c: In function 'btrfs_sysfs_feature_update':
fs/btrfs/sysfs.c:807:16: error: request for member 'state_initialized' in something not a structure or union
if (!fsid_kobj.state_initialized)

                ^

I think this should be fsid_kobj->state_initialized, no?

Of course. What I've tested was

       if (!fs_devs->fsid_kobj.state_initialized)

and removed the "fs_devs->" but did not recompile.

author maintainer
#3 lore raw

PATCH v2 1/1 btrfs: sysfs: check initialization state before updating features

In reply to David Sterba

If the mount phase is not finished, we can't update the sysfs files.

---
v2: fix compilation error

 fs/btrfs/sysfs.c | 3 +++
 1 file changed, 3 insertions(+)
fs/btrfs/sysfs.c +3 -0
index 6986886243bf..539e7b5e3f86 100644
@@ -804,6 +804,9 @@ void btrfs_sysfs_feature_update(struct btrfs_fs_info *fs_info,
 	fs_devs = fs_info->fs_devices;
 	fsid_kobj = &fs_devs->fsid_kobj;
 
+	if (!fsid_kobj->state_initialized)
+		return;
+
 	/*
 	 * FIXME: this is too heavy to update just one value, ideally we'd like
 	 * to use sysfs_update_group but some refactoring is needed first.
Signature · 1 line
1.8.4.5