diff options
author | Shaohua Li <shli@fb.com> | 2016-11-17 02:20:19 +0100 |
---|---|---|
committer | Shaohua Li <shli@fb.com> | 2016-11-17 20:30:27 +0100 |
commit | 354b445b5f84f72e64cef9ffe175548e84c1a874 (patch) | |
tree | 6ff85a9e66fc37c1a92fa21649b029133cd8dd8e /drivers/md | |
parent | md: remove md_super_wait() call after bitmap_flush() (diff) | |
download | linux-354b445b5f84f72e64cef9ffe175548e84c1a874.tar.xz linux-354b445b5f84f72e64cef9ffe175548e84c1a874.zip |
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: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/raid5-cache.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/md/raid5-cache.c b/drivers/md/raid5-cache.c index 2e270e69c550..f73672b0a702 100644 --- a/drivers/md/raid5-cache.c +++ b/drivers/md/raid5-cache.c @@ -970,16 +970,28 @@ static int r5l_recovery_flush_one_stripe(struct r5l_log *log, continue; /* in case device is broken */ + rcu_read_lock(); 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, sh->dev[disk_index].page, REQ_OP_WRITE, 0, false); + rdev_dec_pending(rdev, rdev->mddev); + rcu_read_lock(); + } 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, sh->dev[disk_index].page, REQ_OP_WRITE, 0, false); + rdev_dec_pending(rrdev, rrdev->mddev); + rcu_read_lock(); + } + rcu_read_unlock(); } raid5_release_stripe(sh); return 0; |