Commit 77d30b14 authored by Benjamin LaHaise's avatar Benjamin LaHaise

aio: fix rcu sparse warnings introduced by ioctx table lookup patch

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: default avatarBenjamin LaHaise <bcrl@kvack.org>
Reported-by: default avatarFengguang Wu <fengguang.wu@intel.com>
parent 79bd1bcf
...@@ -470,7 +470,7 @@ static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm) ...@@ -470,7 +470,7 @@ static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm)
struct aio_ring *ring; struct aio_ring *ring;
spin_lock(&mm->ioctx_lock); spin_lock(&mm->ioctx_lock);
table = mm->ioctx_table; table = rcu_dereference(mm->ioctx_table);
while (1) { while (1) {
if (table) if (table)
...@@ -498,7 +498,7 @@ static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm) ...@@ -498,7 +498,7 @@ static int ioctx_add_table(struct kioctx *ctx, struct mm_struct *mm)
table->nr = new_nr; table->nr = new_nr;
spin_lock(&mm->ioctx_lock); spin_lock(&mm->ioctx_lock);
old = mm->ioctx_table; old = rcu_dereference(mm->ioctx_table);
if (!old) { if (!old) {
rcu_assign_pointer(mm->ioctx_table, table); rcu_assign_pointer(mm->ioctx_table, table);
...@@ -622,7 +622,7 @@ static void kill_ioctx(struct mm_struct *mm, struct kioctx *ctx) ...@@ -622,7 +622,7 @@ static void kill_ioctx(struct mm_struct *mm, struct kioctx *ctx)
struct kioctx_table *table; struct kioctx_table *table;
spin_lock(&mm->ioctx_lock); spin_lock(&mm->ioctx_lock);
table = mm->ioctx_table; table = rcu_dereference(mm->ioctx_table);
WARN_ON(ctx != table->table[ctx->id]); WARN_ON(ctx != table->table[ctx->id]);
table->table[ctx->id] = NULL; table->table[ctx->id] = NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment