Commit 354b445b authored by Shaohua Li's avatar Shaohua Li

raid5-cache: fix lockdep warning

lockdep reports warning of the rcu_dereference usage. Using normal rdev
access pattern to avoid the warning.
Signed-off-by: default avatarShaohua Li <shli@fb.com>
parent 6119e679
...@@ -970,16 +970,28 @@ static int r5l_recovery_flush_one_stripe(struct r5l_log *log, ...@@ -970,16 +970,28 @@ static int r5l_recovery_flush_one_stripe(struct r5l_log *log,
continue; continue;
/* in case device is broken */ /* in case device is broken */
rcu_read_lock();
rdev = rcu_dereference(conf->disks[disk_index].rdev); rdev = rcu_dereference(conf->disks[disk_index].rdev);
if (rdev) if (rdev) {
atomic_inc(&rdev->nr_pending);
rcu_read_unlock();
sync_page_io(rdev, stripe_sect, PAGE_SIZE, sync_page_io(rdev, stripe_sect, PAGE_SIZE,
sh->dev[disk_index].page, REQ_OP_WRITE, 0, sh->dev[disk_index].page, REQ_OP_WRITE, 0,
false); false);
rdev_dec_pending(rdev, rdev->mddev);
rcu_read_lock();
}
rrdev = rcu_dereference(conf->disks[disk_index].replacement); rrdev = rcu_dereference(conf->disks[disk_index].replacement);
if (rrdev) if (rrdev) {
atomic_inc(&rrdev->nr_pending);
rcu_read_unlock();
sync_page_io(rrdev, stripe_sect, PAGE_SIZE, sync_page_io(rrdev, stripe_sect, PAGE_SIZE,
sh->dev[disk_index].page, REQ_OP_WRITE, 0, sh->dev[disk_index].page, REQ_OP_WRITE, 0,
false); false);
rdev_dec_pending(rrdev, rrdev->mddev);
rcu_read_lock();
}
rcu_read_unlock();
} }
raid5_release_stripe(sh); raid5_release_stripe(sh);
return 0; return 0;
......
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