linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kernfs: handle poll correctly on 'direct_read' files.
@ 2015-03-15 23:44 NeilBrown
  2015-03-16 16:30 ` Tejun Heo
  0 siblings, 1 reply; 2+ messages in thread
From: NeilBrown @ 2015-03-15 23:44 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Tejun Heo
  Cc: linux-kernel, Prakash Punnoor, Torsten Kaiser, linux RAID

[-- Attachment #1: Type: text/plain, Size: 994 bytes --]



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: 750f199ee8b578062341e6ddfe36c59ac8ff2dcb
Signed-off-by: NeilBrown <neilb@suse.de>

diff --git a/fs/kernfs/file.c b/fs/kernfs/file.c
index b684e8a132e6..2bacb9988566 100644
--- a/fs/kernfs/file.c
+++ b/fs/kernfs/file.c
@@ -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);

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

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

* Re: [PATCH] kernfs: handle poll correctly on 'direct_read' files.
  2015-03-15 23:44 [PATCH] kernfs: handle poll correctly on 'direct_read' files NeilBrown
@ 2015-03-16 16:30 ` Tejun Heo
  0 siblings, 0 replies; 2+ messages in thread
From: Tejun Heo @ 2015-03-16 16:30 UTC (permalink / raw)
  To: NeilBrown
  Cc: Greg Kroah-Hartman, linux-kernel, Prakash Punnoor, Torsten Kaiser,
	linux RAID

On Mon, Mar 16, 2015 at 10:44:52AM +1100, NeilBrown wrote:
> 
> 
> 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: 750f199ee8b578062341e6ddfe36c59ac8ff2dcb

This fixes tag is kinda weird without further explanation.

> Signed-off-by: NeilBrown <neilb@suse.de>

Acked-by: Tejun Heo <tj@kernel.org>

Thanks.

-- 
tejun

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

end of thread, other threads:[~2015-03-16 16:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-15 23:44 [PATCH] kernfs: handle poll correctly on 'direct_read' files NeilBrown
2015-03-16 16:30 ` Tejun Heo

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