From: Jason Baron <jbaron@redhat.com>
To: "Yurij M. Plotnikov" <Yurij.Plotnikov@oktetlabs.ru>
Cc: linux-kernel@vger.kernel.org,
"Alexandra N. Kossovsky" <Alexandra.Kossovsky@oktetlabs.ru>,
akpm@linux-foundation.org
Subject: Re: Dead circle in epoll file descriptor causes soft lockup on kernel 3.2.12
Date: Tue, 27 Mar 2012 10:05:10 -0400 [thread overview]
Message-ID: <20120327140510.GA2419@redhat.com> (raw)
In-Reply-To: <4F717174.9090008@oktetlabs.ru>
On Tue, Mar 27, 2012 at 11:51:16AM +0400, Yurij M. Plotnikov wrote:
> Adding epoll file descriptors in each other in circle causes soft
> lockup on kernel 3.2.12 (I'm using Debian kernel
> 3.2.0-0.bpo.1-amd64). The following steps describe the problem:
>
> 1. epoll_create(1) -> 3
> 2. epoll_create(1) -> 4
> 3. socket(SOCK_STREAM) -> 5
> 4. bind(5, 0.0.0.0:0) -> 0
> 5. listen(5, 1) -> 0
> 6. epoll_ctl(3, ADD, 5, events = 0) -> 0
> 7. epoll_ctl(3, ADD, 4, events = EPOLLIN) -> 0
> 8. epoll_ctl(4, ADD, 3, events = EPOLLIN) -> -1(ELOOP)
> 9. close(3) -> 0
> 10. close(4) -> 0
> 11. close(5) -> 0
>
> After repetaing this sequence 2-3 times soft lockup appers. In
> attachment c program to reproduce this problem.
>
Good catch. The patch below should fix this - please verify. Thanks.
Make sure we clear the tfile_check_list on error.
Signed-off-by: Jason Baron <jbaron@redhat.com>
---
fs/eventpoll.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index c33b347..9af6e18 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -1652,8 +1652,10 @@ SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd,
if (op == EPOLL_CTL_ADD) {
if (is_file_epoll(tfile)) {
error = -ELOOP;
- if (ep_loop_check(ep, tfile) != 0)
+ if (ep_loop_check(ep, tfile) != 0) {
+ clear_tfile_check_list();
goto error_tgt_fput;
+ }
} else
list_add(&tfile->f_tfile_llink, &tfile_check_list);
}
--
1.7.7.6
next prev parent reply other threads:[~2012-03-27 14:10 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-27 7:51 Dead circle in epoll file descriptor causes soft lockup on kernel 3.2.12 Yurij M. Plotnikov
2012-03-27 14:05 ` Jason Baron [this message]
2012-03-28 10:57 ` Alexandra N. Kossovsky
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=20120327140510.GA2419@redhat.com \
--to=jbaron@redhat.com \
--cc=Alexandra.Kossovsky@oktetlabs.ru \
--cc=Yurij.Plotnikov@oktetlabs.ru \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.