Skip to content

Commit

Permalink
md/raid10: fix: incompatible types in comparison expression (differen…
Browse files Browse the repository at this point in the history
…t address spaces).

Fixes the following sparse errors in drivers/md/raid10.c error:
incompatible types in comparison expression (different address spaces).

The error was because of the following line in function read_balance():

rdev = rcu_dereference(conf->mirrors[disk].replacement);
    if (rdev == NULL || test_bit(Faulty, &rdev->flags) ||
        r10_bio->devs[slot].addr + sectors > rdev->recovery_offset)
    rdev = rcu_dereference(conf->mirrors[disk].rdev);

Annotating the struct md_rdev *rdev and *replacement in
drivers/md/raid10.h with __rcu fixes the sparse error.

Signed-off-by: YANG LI <abaci-bugfix@linux.alibaba.com>
Reported-by: Abaci <abaci@linux.alibaba.com>
  • Loading branch information
YANG LI authored and intel-lab-lkp committed Dec 22, 2020
1 parent bca5b06 commit 6efb13c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/md/raid10.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
*/

struct raid10_info {
struct md_rdev *rdev, *replacement;
struct md_rdev __rcu *rdev;
struct md_rdev __rcu *replacement;
sector_t head_position;
int recovery_disabled; /* matches
* mddev->recovery_disabled
Expand Down

0 comments on commit 6efb13c

Please sign in to comment.