From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752728AbbCOXpQ (ORCPT ); Sun, 15 Mar 2015 19:45:16 -0400 Received: from cantor2.suse.de ([195.135.220.15]:34460 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752584AbbCOXpM (ORCPT ); Sun, 15 Mar 2015 19:45:12 -0400 Date: Mon, 16 Mar 2015 10:44:52 +1100 From: NeilBrown To: Greg Kroah-Hartman , Tejun Heo Cc: linux-kernel@vger.kernel.org, Prakash Punnoor , Torsten Kaiser , linux RAID Subject: [PATCH] kernfs: handle poll correctly on 'direct_read' files. Message-ID: <20150316104452.366bffc0@notabene.brown> X-Mailer: Claws Mail 3.10.1-162-g4d0ed6 (GTK+ 2.24.25; x86_64-suse-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; boundary="Sig_/Dyc_uFBn2Om3ig_zrj+SipM"; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Sig_/Dyc_uFBn2Om3ig_zrj+SipM Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable 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 Reported-by: Torsten Kaiser Fixes: 750f199ee8b578062341e6ddfe36c59ac8ff2dcb Signed-off-by: NeilBrown 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_op= en_file *of, goto out_free; } =20 + of->event =3D atomic_read(&of->kn->attr.open->event); ops =3D kernfs_ops(of->kn); if (ops->read) len =3D ops->read(of, buf, len, *ppos); --Sig_/Dyc_uFBn2Om3ig_zrj+SipM Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIVAwUBVQYZdDnsnt1WYoG5AQKd3hAAiDZXpMs4abX2hp+Ip19UG99XXCEGEuuL BNp8h7OK4/n5SDsQ8a7YJKwHy4O1WbcytcvRKdd8jyiVO5Bq9DkuVKEwKIIV8B+4 j41sw/hxON63t2+zsXdweagcO0XnpT5fl3u5hiiXe4eomUaPD0/qcoOofT1WmTpy qcBxrecdDzQt+8OHAyD8kLILoFlFU0M5zlDWS0pztIKqP2UjixBPFrDb4x18UPSt /d2gnHf6ZCB/O4Pwmy9bNL6AMb3VoNn4+FJoQrX/J1AYGuPsTl7oITc/fOZ4TYLk bNRjsEJRV2JS4cie1d9OuMK23pZFDHKEeUhQXu8MPuMNsEt94MalOe8FtX65eZyf P8UZEu2jGeXjQiClOqO/HmRtDNwc7a8QgDuLe3M9egB1ZKtoPGN/A2ELzs9/IY8X Ei/kplKPLx769loXErOoBRJFndd3Hjln3NS0KEIuKfWpUF6p8pLOYzQn0y0YEp+k 15Tj4jKtX1wJ6xgyTNBUT2/jYWpI7R4tNje8tK+4ZYAxjHayg/Ch/JdicVVvKlI0 HhlIBSfpBNlkBVLkOV44H5/98yGFsNHeemxLgaF0voJLCp7gcKifZPKemWHlQT89 Ps+uecTzE7G3Db9/4oLULku0E1aLUpCVqk5CbiUNaJo3uT2CeqNRkJfmb0q+hZOC mTEcShJl93M= =DAtK -----END PGP SIGNATURE----- --Sig_/Dyc_uFBn2Om3ig_zrj+SipM--