linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] btrfs: sysfs: check initialization state before updating features
@ 2016-01-27 10:14 David Sterba
  2016-01-27 11:20 ` Holger Hoffstätte
  2016-01-27 13:06 ` [PATCH v2] " David Sterba
  0 siblings, 2 replies; 5+ messages in thread
From: David Sterba @ 2016-01-27 10:14 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

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;
+
 	/*
 	 * 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.
-- 
1.8.4.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: sysfs: check initialization state before updating features
  2016-01-27 10:14 [PATCH] btrfs: sysfs: check initialization state before updating features David Sterba
@ 2016-01-27 11:20 ` Holger Hoffstätte
  2016-01-27 12:39   ` David Sterba
  2016-01-27 13:06 ` [PATCH v2] " David Sterba
  1 sibling, 1 reply; 5+ messages in thread
From: Holger Hoffstätte @ 2016-01-27 11:20 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] btrfs: sysfs: check initialization state before updating features
  2016-01-27 11:20 ` Holger Hoffstätte
@ 2016-01-27 12:39   ` David Sterba
  0 siblings, 0 replies; 5+ messages in thread
From: David Sterba @ 2016-01-27 12:39 UTC (permalink / raw)
  To: Holger Hoffstätte; +Cc: David Sterba, linux-btrfs

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. 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v2] btrfs: sysfs: check initialization state before updating features
  2016-01-27 10:14 [PATCH] btrfs: sysfs: check initialization state before updating features David Sterba
  2016-01-27 11:20 ` Holger Hoffstätte
@ 2016-01-27 13:06 ` David Sterba
  2016-01-27 14:26   ` Chris Mason
  1 sibling, 1 reply; 5+ messages in thread
From: David Sterba @ 2016-01-27 13:06 UTC (permalink / raw)
  To: linux-btrfs; +Cc: David Sterba

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(+)

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.
-- 
1.8.4.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH v2] btrfs: sysfs: check initialization state before updating features
  2016-01-27 13:06 ` [PATCH v2] " David Sterba
@ 2016-01-27 14:26   ` Chris Mason
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Mason @ 2016-01-27 14:26 UTC (permalink / raw)
  To: David Sterba; +Cc: linux-btrfs

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-01-27 14:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-27 10:14 [PATCH] btrfs: sysfs: check initialization state before updating features David Sterba
2016-01-27 11:20 ` Holger Hoffstätte
2016-01-27 12:39   ` David Sterba
2016-01-27 13:06 ` [PATCH v2] " David Sterba
2016-01-27 14:26   ` Chris Mason

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).