|
@@ -457,6 +457,8 @@ static inline struct kiocb *aio_get_req(struct kioctx *ctx)
|
|
|
|
|
|
static inline void really_put_req(struct kioctx *ctx, struct kiocb *req)
|
|
|
{
|
|
|
+ assert_spin_locked(&ctx->ctx_lock);
|
|
|
+
|
|
|
if (req->ki_dtor)
|
|
|
req->ki_dtor(req);
|
|
|
kmem_cache_free(kiocb_cachep, req);
|
|
@@ -498,6 +500,8 @@ static int __aio_put_req(struct kioctx *ctx, struct kiocb *req)
|
|
|
dprintk(KERN_DEBUG "aio_put(%p): f_count=%d\n",
|
|
|
req, atomic_read(&req->ki_filp->f_count));
|
|
|
|
|
|
+ assert_spin_locked(&ctx->ctx_lock);
|
|
|
+
|
|
|
req->ki_users --;
|
|
|
if (unlikely(req->ki_users < 0))
|
|
|
BUG();
|
|
@@ -619,14 +623,13 @@ static void unuse_mm(struct mm_struct *mm)
|
|
|
* the kiocb (to tell the caller to activate the work
|
|
|
* queue to process it), or 0, if it found that it was
|
|
|
* already queued.
|
|
|
- *
|
|
|
- * Should be called with the spin lock iocb->ki_ctx->ctx_lock
|
|
|
- * held
|
|
|
*/
|
|
|
static inline int __queue_kicked_iocb(struct kiocb *iocb)
|
|
|
{
|
|
|
struct kioctx *ctx = iocb->ki_ctx;
|
|
|
|
|
|
+ assert_spin_locked(&ctx->ctx_lock);
|
|
|
+
|
|
|
if (list_empty(&iocb->ki_run_list)) {
|
|
|
list_add_tail(&iocb->ki_run_list,
|
|
|
&ctx->run_list);
|
|
@@ -771,13 +774,15 @@ out:
|
|
|
* Process all pending retries queued on the ioctx
|
|
|
* run list.
|
|
|
* Assumes it is operating within the aio issuer's mm
|
|
|
- * context. Expects to be called with ctx->ctx_lock held
|
|
|
+ * context.
|
|
|
*/
|
|
|
static int __aio_run_iocbs(struct kioctx *ctx)
|
|
|
{
|
|
|
struct kiocb *iocb;
|
|
|
LIST_HEAD(run_list);
|
|
|
|
|
|
+ assert_spin_locked(&ctx->ctx_lock);
|
|
|
+
|
|
|
list_splice_init(&ctx->run_list, &run_list);
|
|
|
while (!list_empty(&run_list)) {
|
|
|
iocb = list_entry(run_list.next, struct kiocb,
|
|
@@ -1604,12 +1609,14 @@ asmlinkage long sys_io_submit(aio_context_t ctx_id, long nr,
|
|
|
|
|
|
/* lookup_kiocb
|
|
|
* Finds a given iocb for cancellation.
|
|
|
- * MUST be called with ctx->ctx_lock held.
|
|
|
*/
|
|
|
static struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb,
|
|
|
u32 key)
|
|
|
{
|
|
|
struct list_head *pos;
|
|
|
+
|
|
|
+ assert_spin_locked(&ctx->ctx_lock);
|
|
|
+
|
|
|
/* TODO: use a hash or array, this sucks. */
|
|
|
list_for_each(pos, &ctx->active_reqs) {
|
|
|
struct kiocb *kiocb = list_kiocb(pos);
|