From: Johannes Weiner <hannes@cmpxchg.org>
To: akpm@linux-foundation.org
Cc: shawn.bohrer@gmail.com, davidel@xmailserver.org,
linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
mm-commits@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [patch] epoll-fix-compiler-warning-and-optimize-the-non-blocking-path-fix
Date: Wed, 26 Jan 2011 11:20:20 +0100 [thread overview]
Message-ID: <20110126102020.GA2244@cmpxchg.org> (raw)
In-Reply-To: <201101260021.p0Q0LxsS016458@imap1.linux-foundation.org>
The non-blocking ep_poll path optimization introduced skipping over
the return value setup.
Initialize it properly, my userspace gets upset by epoll_wait()
returning random things.
In addition, remove the reinitialization at the fetch_events label,
the return value is garuanteed to be zero when execution reaches
there.
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Shawn Bohrer <shawn.bohrer@gmail.com>
Cc: Davide Libenzi <davidel@xmailserver.org>
---
fs/eventpoll.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index f7cb6cb..afe4238 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1147,7 +1147,7 @@ static int ep_send_events(struct eventpoll *ep,
static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
int maxevents, long timeout)
{
- int res, eavail, timed_out = 0;
+ int res = 0, eavail, timed_out = 0;
unsigned long flags;
long slack = 0;
wait_queue_t wait;
@@ -1173,7 +1173,6 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
fetch_events:
spin_lock_irqsave(&ep->lock, flags);
- res = 0;
if (!ep_events_available(ep)) {
/*
* We don't have any available event to return to the caller.
--
1.7.3.5
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2011-01-26 10:20 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-25 23:48 mmotm 2011-01-25-15-47 uploaded akpm
2011-01-26 8:45 ` CAI Qian
2011-01-26 13:52 ` Andrea Arcangeli
2011-01-28 6:44 ` CAI Qian
2011-01-28 16:50 ` pgd_lock must be taken with irqs enabled Andrea Arcangeli
2011-01-26 10:20 ` Johannes Weiner [this message]
2011-01-26 15:05 ` [patch] epoll-fix-compiler-warning-and-optimize-the-non-blocking-path-fix Davide Libenzi
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=20110126102020.GA2244@cmpxchg.org \
--to=hannes@cmpxchg.org \
--cc=akpm@linux-foundation.org \
--cc=davidel@xmailserver.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mm-commits@vger.kernel.org \
--cc=shawn.bohrer@gmail.com \
/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;
as well as URLs for NNTP newsgroup(s).