diff options
| -rw-r--r-- | fs/aio.c | 14 |
1 files changed, 3 insertions, 11 deletions
| @@ -554,8 +554,7 @@ static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm) | |||
| 554 | struct aio_ring *ring; | 554 | struct aio_ring *ring; |
| 555 | 555 | ||
| 556 | spin_lock(&mm->ioctx_lock); | 556 | spin_lock(&mm->ioctx_lock); |
| 557 | rcu_read_lock(); | 557 | table = rcu_dereference_raw(mm->ioctx_table); |
| 558 | table = rcu_dereference(mm->ioctx_table); | ||
| 559 | 558 | ||
| 560 | while (1) { | 559 | while (1) { |
| 561 | if (table) | 560 | if (table) |
| @@ -563,7 +562,6 @@ static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm) | |||
| 563 | if (!table->table[i]) { | 562 | if (!table->table[i]) { |
| 564 | ctx->id = i; | 563 | ctx->id = i; |
| 565 | table->table[i] = ctx; | 564 | table->table[i] = ctx; |
| 566 | rcu_read_unlock(); | ||
| 567 | spin_unlock(&mm->ioctx_lock); | 565 | spin_unlock(&mm->ioctx_lock); |
| 568 | 566 | ||
| 569 | /* While kioctx setup is in progress, | 567 | /* While kioctx setup is in progress, |
| @@ -577,8 +575,6 @@ static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm) | |||
| 577 | } | 575 | } |
| 578 | 576 | ||
| 579 | new_nr = (table ? table->nr : 1) * 4; | 577 | new_nr = (table ? table->nr : 1) * 4; |
| 580 | |||
| 581 | rcu_read_unlock(); | ||
| 582 | spin_unlock(&mm->ioctx_lock); | 578 | spin_unlock(&mm->ioctx_lock); |
| 583 | 579 | ||
| 584 | table = kzalloc(sizeof(*table) + sizeof(struct kioctx *) * | 580 | table = kzalloc(sizeof(*table) + sizeof(struct kioctx *) * |
| @@ -589,8 +585,7 @@ static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm) | |||
| 589 | table->nr = new_nr; | 585 | table->nr = new_nr; |
| 590 | 586 | ||
| 591 | spin_lock(&mm->ioctx_lock); | 587 | spin_lock(&mm->ioctx_lock); |
| 592 | rcu_read_lock(); | 588 | old = rcu_dereference_raw(mm->ioctx_table); |
| 593 | old = rcu_dereference(mm->ioctx_table); | ||
| 594 | 589 | ||
| 595 | if (!old) { | 590 | if (!old) { |
| 596 | rcu_assign_pointer(mm->ioctx_table, table); | 591 | rcu_assign_pointer(mm->ioctx_table, table); |
| @@ -737,12 +732,9 @@ static int kill_ioctx(struct mm_struct *mm, struct kioctx *ctx, | |||
| 737 | 732 | ||
| 738 | 733 | ||
| 739 | spin_lock(&mm->ioctx_lock); | 734 | spin_lock(&mm->ioctx_lock); |
| 740 | rcu_read_lock(); | 735 | table = rcu_dereference_raw(mm->ioctx_table); |
| 741 | table = rcu_dereference(mm->ioctx_table); | ||
| 742 | |||
| 743 | WARN_ON(ctx != table->table[ctx->id]); | 736 | WARN_ON(ctx != table->table[ctx->id]); |
| 744 | table->table[ctx->id] = NULL; | 737 | table->table[ctx->id] = NULL; |
| 745 | rcu_read_unlock(); | ||
| 746 | spin_unlock(&mm->ioctx_lock); | 738 | spin_unlock(&mm->ioctx_lock); |
| 747 | 739 | ||
| 748 | /* percpu_ref_kill() will do the necessary call_rcu() */ | 740 | /* percpu_ref_kill() will do the necessary call_rcu() */ |
