[PATCH] change lock model in aio_put_req

From: mihailov ivan
Date: Wed Jun 06 2012 - 18:46:59 EST


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);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/