mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Ashutosh Dixit <ashutosh.dixit@intel.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Arnd Bergmann <arnd@arndb.de>,
	linux-kernel@vger.kernel.org,
	virtualization@lists.linux-foundation.org
Cc: Dasaratharaman Chandramouli 
	<dasaratharaman.chandramouli@intel.com>,
	Ashutosh Dixit <ashutosh.dixit@intel.com>,
	Sudeep Dutt <sudeep.dutt@intel.com>,
	Nikhil Rao <nikhil.rao@intel.com>,
	Siva Krishna Kumar Reddy Yerramreddy 
	<siva.krishna.kumar.reddy.yerramreddy@intel.com>,
	Caz Yokoyama <Caz.Yokoyama@intel.com>
Subject: [PATCH char-misc-linus v3 3/6] misc: mic: Bug fix for sysfs poll usage.
Date: Wed, 27 Nov 2013 08:58:40 -0800	[thread overview]
Message-ID: <110d7ea2d60d47682da4208a07646a97b0f00585.1385569514.git.ashutosh.dixit@intel.com> (raw)
In-Reply-To: <cover.1385527468.git.ashutosh.dixit@intel.com>
In-Reply-To: <cover.1385569514.git.ashutosh.dixit@intel.com>

MIC user space daemon poll's on sysfs changes. The documentation for
sysfs_poll(...) in fs/sysfs/file.c states that "Once poll/select
indicates that the value has changed, you need to close and re-open the
file, or seek to 0 and read again". This step was missed out earlier and
resulted in the daemon spinning continuously rather than getting blocked
in 'poll'. This bug was exposed by commit aea585ef8fa65163 introduced as
part of sysfs changes in 3.13-rc1. A seek to 0 has been introduced to
fix it.

Reviewed-by: Sudeep Dutt <sudeep.dutt@intel.com>
Signed-off-by: Ashutosh Dixit <ashutosh.dixit@intel.com>
---
 Documentation/mic/mpssd/mpssd.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Documentation/mic/mpssd/mpssd.c b/Documentation/mic/mpssd/mpssd.c
index 0c980ad..5c7fdda 100644
--- a/Documentation/mic/mpssd/mpssd.c
+++ b/Documentation/mic/mpssd/mpssd.c
@@ -1412,6 +1412,12 @@ mic_config(void *arg)
 	}
 
 	do {
+		ret = lseek(fd, 0, SEEK_SET);
+		if (ret < 0) {
+			mpsslog("%s: Failed to seek to file start '%s': %s\n",
+				mic->name, pathname, strerror(errno));
+			goto close_error1;
+		}
 		ret = read(fd, value, sizeof(value));
 		if (ret < 0) {
 			mpsslog("%s: Failed to read sysfs entry '%s': %s\n",
-- 
1.8.2.3


  parent reply	other threads:[~2013-11-27 16:51 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-27 16:58 [PATCH char-misc-linus v3 0/6] misc: mic: Fixes for 3.13-final Ashutosh Dixit
     [not found] ` <cover.1385569514.git.ashutosh.dixit@intel.com>
2013-11-27 16:58   ` [PATCH char-misc-linus v3 1/6] misc: mic: Change mic_notify(...) to return true Ashutosh Dixit
2013-11-27 16:58   ` [PATCH char-misc-linus v3 2/6] misc: mic: Minor bug fix in 'retry' loops Ashutosh Dixit
2013-11-27 16:58   ` Ashutosh Dixit [this message]
2013-11-27 16:58   ` [PATCH char-misc-linus v3 4/6] misc: mic: Fix user space namespace pollution from mic_common.h Ashutosh Dixit
2013-11-27 16:58   ` [PATCH char-misc-linus v3 5/6] misc: mic: Fix endianness issues Ashutosh Dixit
2013-11-27 16:58   ` [PATCH char-misc-linus v3 6/6] misc: mic: Suppress memory space sparse warnings Ashutosh Dixit
2013-11-27 19:11 ` [PATCH char-misc-linus v3 0/6] misc: mic: Fixes for 3.13-final Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=110d7ea2d60d47682da4208a07646a97b0f00585.1385569514.git.ashutosh.dixit@intel.com \
    --to=ashutosh.dixit@intel.com \
    --cc=Caz.Yokoyama@intel.com \
    --cc=arnd@arndb.de \
    --cc=dasaratharaman.chandramouli@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nikhil.rao@intel.com \
    --cc=siva.krishna.kumar.reddy.yerramreddy@intel.com \
    --cc=sudeep.dutt@intel.com \
    --cc=virtualization@lists.linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®