diff mbox

btrfs: sysfs: check initialization state before updating features

Message ID 1453889679-25588-1-git-send-email-dsterba@suse.com (mailing list archive)
State Superseded
Headers show

Commit Message

David Sterba Jan. 27, 2016, 10:14 a.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>
---
 fs/btrfs/sysfs.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Holger Hoffstätte Jan. 27, 2016, 11:20 a.m. UTC | #1
On Wed, Jan 27, 2016 at 11:14 AM, David Sterba <dsterba@suse.com> 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>
> ---
>  fs/btrfs/sysfs.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
> index 6986886243bf..1ae146a8093c 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;
> +

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
--
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
David Sterba Jan. 27, 2016, 12:39 p.m. UTC | #2
On Wed, Jan 27, 2016 at 12:20:48PM +0100, Holger Hoffstätte wrote:
> On Wed, Jan 27, 2016 at 11:14 AM, David Sterba <dsterba@suse.com> 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>
> > ---
> >  fs/btrfs/sysfs.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
> > index 6986886243bf..1ae146a8093c 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;
> > +
> 
> 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?

Of course. What I've tested was

       if (!fs_devs->fsid_kobj.state_initialized)

and removed the "fs_devs->" but did not recompile. 
--
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..1ae146a8093c 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.