]> err.no Git - linux-2.6/commitdiff
sysfs: Make poll behaviour consistent
authorJuha Yrjölä <juha.yrjola@solidboot.com>
Thu, 3 Aug 2006 16:06:25 +0000 (19:06 +0300)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 26 Sep 2006 04:08:36 +0000 (21:08 -0700)
When no events have been reported by sysfs_notify(), sd->s_events
was previously set to zero.  The initial value for new readers is
also zero, so poll was blocking, regardless of whether the attribute
was read by the process or not.

Make poll behave consistently by setting the initial value of
sd->s_events to non-zero.

Signed-off-by: Juha Yrjola <juha.yrjola@solidboot.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/sysfs/dir.c

index 61c42430cba3159e5cce02d8675cb2d8c1bec14b..5f3d725d11251487481c57599bc0f0ddedcfe904 100644 (file)
@@ -43,7 +43,7 @@ static struct sysfs_dirent * sysfs_new_dirent(struct sysfs_dirent * parent_sd,
 
        memset(sd, 0, sizeof(*sd));
        atomic_set(&sd->s_count, 1);
-       atomic_set(&sd->s_event, 0);
+       atomic_set(&sd->s_event, 1);
        INIT_LIST_HEAD(&sd->s_children);
        list_add(&sd->s_sibling, &parent_sd->s_children);
        sd->s_element = element;