From: Davide Libenzi <davidel@xmailserver.org>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
Zach Brown <zach.brown@oracle.com>,
Jeff Roberson <jroberson@chesapeake.net>
Subject: [patch] eventfd/kaio integration fix
Date: Wed, 9 Apr 2008 11:45:47 -0700 (PDT) [thread overview]
Message-ID: <Pine.LNX.4.64.0804091138050.7000@alien.or.mcafeemobile.com> (raw)
Jeff Roberson discovered a race when using kaio eventfd based
notifications. This patch fixes the race by moving the notification inside
the spinlocked section of kaio. The operation is safe since eventfd
spinlock and kaio one are unrelated.
Signed-off-by: Davide Libenzi <davidel@xmailserver.org>
- Davide
---
fs/aio.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)
Index: linux-2.6.mod/fs/aio.c
===================================================================
--- linux-2.6.mod.orig/fs/aio.c 2008-04-08 16:25:27.000000000 -0700
+++ linux-2.6.mod/fs/aio.c 2008-04-09 11:37:10.000000000 -0700
@@ -936,14 +936,6 @@
return 1;
}
- /*
- * Check if the user asked us to deliver the result through an
- * eventfd. The eventfd_signal() function is safe to be called
- * from IRQ context.
- */
- if (!IS_ERR(iocb->ki_eventfd))
- eventfd_signal(iocb->ki_eventfd, 1);
-
info = &ctx->ring_info;
/* add a completion event to the ring buffer.
@@ -992,6 +984,15 @@
kunmap_atomic(ring, KM_IRQ1);
pr_debug("added to ring %p at [%lu]\n", iocb, tail);
+
+ /*
+ * Check if the user asked us to deliver the result through an
+ * eventfd. The eventfd_signal() function is safe to be called
+ * from IRQ context.
+ */
+ if (!IS_ERR(iocb->ki_eventfd))
+ eventfd_signal(iocb->ki_eventfd, 1);
+
put_rq:
/* everything turned out well, dispose of the aiocb. */
ret = __aio_put_req(ctx, iocb);
next reply other threads:[~2008-04-09 18:46 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-09 18:45 Davide Libenzi [this message]
2008-04-09 19:08 ` Andrew Morton
2008-04-09 19:19 ` Davide Libenzi
2008-04-09 19:33 ` Jeff Roberson
2008-04-13 12:29 ` Oliver Pinter
2008-04-13 22:57 ` Davide Libenzi
2008-04-14 17:56 ` Oliver Pinter
2008-04-14 18:02 ` 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=Pine.LNX.4.64.0804091138050.7000@alien.or.mcafeemobile.com \
--to=davidel@xmailserver.org \
--cc=akpm@linux-foundation.org \
--cc=jroberson@chesapeake.net \
--cc=linux-kernel@vger.kernel.org \
--cc=zach.brown@oracle.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
all inboxes | Powered by JetHome®