Skip to content

Commit

Permalink
aio: fix rcu sparse warnings introduced by ioctx table lookup patch
Browse files Browse the repository at this point in the history
Sseveral sparse warnings were caused by missing rcu_dereference() annotations
for dereferencing mm->ioctx_table.  Thankfully, none of those were actual bugs
as the deref was protected by a spin lock in all instances.

Signed-off-by: Benjamin LaHaise <[email protected]>
Reported-by: Fengguang Wu <[email protected]>
  • Loading branch information
bcrl committed Aug 30, 2013
1 parent 79bd1bc commit 77d30b1
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fs/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm)
struct aio_ring *ring;

spin_lock(&mm->ioctx_lock);
table = mm->ioctx_table;
table = rcu_dereference(mm->ioctx_table);

while (1) {
if (table)
Expand Down Expand Up @@ -498,7 +498,7 @@ static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm)
table->nr = new_nr;

spin_lock(&mm->ioctx_lock);
old = mm->ioctx_table;
old = rcu_dereference(mm->ioctx_table);

if (!old) {
rcu_assign_pointer(mm->ioctx_table, table);
Expand Down Expand Up @@ -622,7 +622,7 @@ static void kill_ioctx(struct mm_struct *mm, struct kioctx *ctx)
struct kioctx_table *table;

spin_lock(&mm->ioctx_lock);
table = mm->ioctx_table;
table = rcu_dereference(mm->ioctx_table);

WARN_ON(ctx != table->table[ctx->id]);
table->table[ctx->id] = NULL;
Expand Down

0 comments on commit 77d30b1

Please sign in to comment.