diff options
author | Logan Gunthorpe <logang@deltatee.com> | 2022-04-07 19:57:09 +0300 |
---|---|---|
committer | Song Liu <song@kernel.org> | 2022-04-26 00:00:36 +0300 |
commit | b0920ede081b3f1659872f80ce552305610675a6 (patch) | |
tree | b3ba5ec43ed8581e60a4535b43e6dd00dfe6f5c3 /drivers/md/raid5.h | |
parent | 3d9a644cf45c26ad1d0ceff0af8c9e9860677729 (diff) | |
download | linux-b0920ede081b3f1659872f80ce552305610675a6.tar.xz |
md/raid5: Add __rcu annotation to struct disk_info
rdev and replacement are protected in some circumstances with
rcu_dereference and synchronize_rcu (in raid5_remove_disk()). However,
they were not annotated with __rcu so a sparse warning is emitted for
every rcu_dereference() call.
Add the __rcu annotation and fix up the initialization with
RCU_INIT_POINTER, all pointer modifications with rcu_assign_pointer(),
a few cases where the pointer value is tested with rcu_access_pointer()
and one case where READ_ONCE() is used instead of rcu_dereference(),
a case in print_raid5_conf() that should have rcu_dereference() and
rcu_read_[un]lock() calls.
Additional sparse issues will be fixed up in further commits.
Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Song Liu <song@kernel.org>
Diffstat (limited to 'drivers/md/raid5.h')
-rw-r--r-- | drivers/md/raid5.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h index 61bc2e1f1b4e..638d29863503 100644 --- a/drivers/md/raid5.h +++ b/drivers/md/raid5.h @@ -473,7 +473,8 @@ enum { */ struct disk_info { - struct md_rdev *rdev, *replacement; + struct md_rdev __rcu *rdev; + struct md_rdev __rcu *replacement; struct page *extra_page; /* extra page to use in prexor */ }; |