From 23f3a82998912654be41bbbb9048ca6ae1d15ece Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Sun, 13 Nov 2005 16:07:34 -0800 Subject: [PATCH] --- yaml --- r: 14079 b: refs/heads/master c: d00689af6b3b6ba9e1fdefec3bd62edc860c385d h: refs/heads/master i: 14077: 79d35dab49323ba05ad44ba27a05e35185510490 14075: aef8e5e2a26259634d2983c369d3ef3677c9957e 14071: 7c6e6f92339596cdaff695d7feb170efa0331242 14063: 8baa3eb9046c86975084ff040b23e52cba7c4aa9 14047: 96f38e3551bd2818f8132811587d11dca5b00107 14015: 3c54065cd61e87c4d44ae44ec49469e512975c76 13951: 022d6f2880cb0d138a783a5665c39b792be976cf 13823: 203f78dc92c2a095eaf29ba80f6d3b8442cb654a v: v3 --- [refs] | 2 +- trunk/fs/aio.c | 17 ++++++++++++----- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/[refs] b/[refs] index b30c1149ae40..8877eff37c57 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 20dcae32439384b6863c626bb3b2a09bed65b33e +refs/heads/master: d00689af6b3b6ba9e1fdefec3bd62edc860c385d diff --git a/trunk/fs/aio.c b/trunk/fs/aio.c index e7cd40b626b7..5a28b69ad223 100644 --- a/trunk/fs/aio.c +++ b/trunk/fs/aio.c @@ -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 @@ static ssize_t aio_run_iocb(struct kiocb *iocb) * 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);