Skip to content

Commit

Permalink
kernfs: handle poll correctly on 'direct_read' files.
Browse files Browse the repository at this point in the history
Kernfs supports two styles of read: direct_read and seqfile_read.

The latter supports 'poll' correctly thanks to the update of
'->event' in kernfs_seq_show.
The former does not as '->event' is never updated on a read.

So add an appropriate update in kernfs_file_direct_read().

This was noticed because some 'md' sysfs attributes were
recently changed to use direct reads.

Reported-by: Prakash Punnoor <prakash@punnoor.de>
Reported-by: Torsten Kaiser <just.for.lkml@googlemail.com>
Fixes: 750f199
Signed-off-by: NeilBrown <neilb@suse.de>
Acked-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
neilbrown authored and gregkh committed Mar 16, 2015
1 parent 06e5801 commit 7cff4b1
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions fs/kernfs/file.c
Expand Up @@ -207,6 +207,7 @@ static ssize_t kernfs_file_direct_read(struct kernfs_open_file *of,
goto out_free;
}

of->event = atomic_read(&of->kn->attr.open->event);
ops = kernfs_ops(of->kn);
if (ops->read)
len = ops->read(of, buf, len, *ppos);
Expand Down

0 comments on commit 7cff4b1

Please sign in to comment.