]> git.baikalelectronics.ru Git - kernel.git/commit
md/raid5: Annotate rdev/replacement access when mddev_lock is held
authorLogan Gunthorpe <logang@deltatee.com>
Thu, 7 Apr 2022 16:57:11 +0000 (10:57 -0600)
committerSong Liu <song@kernel.org>
Mon, 25 Apr 2022 21:00:37 +0000 (14:00 -0700)
commit66705ed51782346a63b49b00fd5a00a035465788
treefcb2625caff1868e4d18280dc18c8d02bd49a709
parent678f66ad03312cdf57bd575d34641a29ae7e8d49
md/raid5: Annotate rdev/replacement access when mddev_lock is held

The mddev_lock should be held during raid5_remove_disk() which is when
the rdev/replacement pointers are modified. So any access to these
pointers marked __rcu should be safe whenever the mddev_lock is held.

There are numerous such access that currently produce sparse warnings.
Add a helper function, rdev_mdlock_deref() that wraps
rcu_dereference_protected() in all these instances.

This annotation fixes a number of sparse warnings.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Song Liu <song@kernel.org>
drivers/md/raid5.c