[PATCH] aio: replace locking comments with assert_spin_locked()
aio: replace locking comments with assert_spin_locked() Signed-off-by: Zach Brown <zach.brown@oracle.com> Acked-by: Benjamin LaHaise <bcrl@kvack.org> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
parent
20dcae3243
commit
d00689af6b
1 changed files with 12 additions and 5 deletions
17
fs/aio.c
17
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)
|
static inline void really_put_req(struct kioctx *ctx, struct kiocb *req)
|
||||||
{
|
{
|
||||||
|
assert_spin_locked(&ctx->ctx_lock);
|
||||||
|
|
||||||
if (req->ki_dtor)
|
if (req->ki_dtor)
|
||||||
req->ki_dtor(req);
|
req->ki_dtor(req);
|
||||||
kmem_cache_free(kiocb_cachep, 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",
|
dprintk(KERN_DEBUG "aio_put(%p): f_count=%d\n",
|
||||||
req, atomic_read(&req->ki_filp->f_count));
|
req, atomic_read(&req->ki_filp->f_count));
|
||||||
|
|
||||||
|
assert_spin_locked(&ctx->ctx_lock);
|
||||||
|
|
||||||
req->ki_users --;
|
req->ki_users --;
|
||||||
if (unlikely(req->ki_users < 0))
|
if (unlikely(req->ki_users < 0))
|
||||||
BUG();
|
BUG();
|
||||||
|
@ -619,14 +623,13 @@ static void unuse_mm(struct mm_struct *mm)
|
||||||
* the kiocb (to tell the caller to activate the work
|
* the kiocb (to tell the caller to activate the work
|
||||||
* queue to process it), or 0, if it found that it was
|
* queue to process it), or 0, if it found that it was
|
||||||
* already queued.
|
* already queued.
|
||||||
*
|
|
||||||
* Should be called with the spin lock iocb->ki_ctx->ctx_lock
|
|
||||||
* held
|
|
||||||
*/
|
*/
|
||||||
static inline int __queue_kicked_iocb(struct kiocb *iocb)
|
static inline int __queue_kicked_iocb(struct kiocb *iocb)
|
||||||
{
|
{
|
||||||
struct kioctx *ctx = iocb->ki_ctx;
|
struct kioctx *ctx = iocb->ki_ctx;
|
||||||
|
|
||||||
|
assert_spin_locked(&ctx->ctx_lock);
|
||||||
|
|
||||||
if (list_empty(&iocb->ki_run_list)) {
|
if (list_empty(&iocb->ki_run_list)) {
|
||||||
list_add_tail(&iocb->ki_run_list,
|
list_add_tail(&iocb->ki_run_list,
|
||||||
&ctx->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
|
* Process all pending retries queued on the ioctx
|
||||||
* run list.
|
* run list.
|
||||||
* Assumes it is operating within the aio issuer's mm
|
* 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)
|
static int __aio_run_iocbs(struct kioctx *ctx)
|
||||||
{
|
{
|
||||||
struct kiocb *iocb;
|
struct kiocb *iocb;
|
||||||
LIST_HEAD(run_list);
|
LIST_HEAD(run_list);
|
||||||
|
|
||||||
|
assert_spin_locked(&ctx->ctx_lock);
|
||||||
|
|
||||||
list_splice_init(&ctx->run_list, &run_list);
|
list_splice_init(&ctx->run_list, &run_list);
|
||||||
while (!list_empty(&run_list)) {
|
while (!list_empty(&run_list)) {
|
||||||
iocb = list_entry(run_list.next, struct kiocb,
|
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
|
/* lookup_kiocb
|
||||||
* Finds a given iocb for cancellation.
|
* 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,
|
static struct kiocb *lookup_kiocb(struct kioctx *ctx, struct iocb __user *iocb,
|
||||||
u32 key)
|
u32 key)
|
||||||
{
|
{
|
||||||
struct list_head *pos;
|
struct list_head *pos;
|
||||||
|
|
||||||
|
assert_spin_locked(&ctx->ctx_lock);
|
||||||
|
|
||||||
/* TODO: use a hash or array, this sucks. */
|
/* TODO: use a hash or array, this sucks. */
|
||||||
list_for_each(pos, &ctx->active_reqs) {
|
list_for_each(pos, &ctx->active_reqs) {
|
||||||
struct kiocb *kiocb = list_kiocb(pos);
|
struct kiocb *kiocb = list_kiocb(pos);
|
||||||
|
|
Loading…
Reference in a new issue