Skip to contentSkip to conversation

kernfs: handle poll correctly on 'direct_read' files.

PATCH In review NeilBrown 2 participants 2 messages Mar 15, 2015 – Mar 16, 2015

Subsystems (2)
lore
Share & tools
lore

NeilBrown

author
#0 lore raw

PATCH 1/1 kernfs: handle poll correctly on 'direct_read' files.

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.

Fixes 750f199ee8b578062341e6ddfe36c59ac8ff2dcb
fs/kernfs/file.c +1 -0
index b684e8a132e6..2bacb9988566 100644
@@ -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);
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · NeilBrown

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.

Quoted 8 lines

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.

Fixes 750f199ee8b578062341e6ddfe36c59ac8ff2dcb

This fixes tag is kinda weird without further explanation.

Quoted 1 line

Thanks.

Signature · 1 line
tejun