diff mbox

[v2] btrfs: sysfs: check initialization state before updating features

Message ID 1453899989-1710-1-git-send-email-dsterba@suse.com (mailing list archive)
State Accepted
Headers show

Commit Message

David Sterba Jan. 27, 2016, 1:06 p.m. UTC
If the mount phase is not finished, we can't update the sysfs files.

Reported-by: Chris Mason <clm@fb.com>
Signed-off-by: David Sterba <dsterba@suse.com>
---
v2: fix compilation error

 fs/btrfs/sysfs.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Chris Mason Jan. 27, 2016, 2:26 p.m. UTC | #1
On Wed, Jan 27, 2016 at 02:06:29PM +0100, David Sterba wrote:
> If the mount phase is not finished, we can't update the sysfs files.
> 
> Reported-by: Chris Mason <clm@fb.com>
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
> v2: fix compilation error

Thanks Dave, pushed into integration-4.5

-chris
--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index 6986886243bf..539e7b5e3f86 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -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.