mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] change lock model in aio_put_req
@ 2012-06-06 22:46 mihailov ivan
  2012-06-07 14:31 ` Jeff Moyer
  0 siblings, 1 reply; 5+ messages in thread
From: mihailov ivan @ 2012-06-06 22:46 UTC (permalink / raw)
  To: linux-kernel

Why used spin_lock/unlock_irq instead of
spin_lock_irqsave/spin_unlock_irqrestore?
__aio_put_req it's interrupt safe call but why aio_put_req not?

simply if I'll do some kind of this code:

spin_lock_irqsave(&lock, flags);
--some functions 1--
aio_put_req(aiocb);
--some functions 2--
spin_unlock_irqrestore(&lock, flags);

On aio_put_req we unlock all interrupts...
And after that 'some functions 2' unsafe now.

Or this call work as designed?
If not I have smally patchset for that.


--- /usr/src/linux/fs/aio.c	2011-07-22 02:17:23.000000000 +0000
+++ aio.c	2012-06-07 01:12:33.737299121 +0000
@@ -581,10 +581,10 @@
 int aio_put_req(struct kiocb *req)
 {
 	struct kioctx *ctx = req->ki_ctx;
-	int ret;
-	spin_lock_irq(&ctx->ctx_lock);
+	int ret, flags;
+	spin_lock_irqsave(&ctx->ctx_lock, flags);
 	ret = __aio_put_req(ctx, req);
-	spin_unlock_irq(&ctx->ctx_lock);
+	spin_unlock_irqrestore(&ctx->ctx_lock, flags);
 	return ret;
 }
 EXPORT_SYMBOL(aio_put_req);

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-06-07 20:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-06 22:46 [PATCH] change lock model in aio_put_req mihailov ivan
2012-06-07 14:31 ` Jeff Moyer
2012-06-07 19:41   ` mihailov ivan
2012-06-07 19:52     ` Jeff Moyer
2012-06-07 20:30       ` mihailov ivan

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®