On Thu, May 26, 2022 at 10:36:00AM -0600, Logan Gunthorpe wrote: > The mdadm test 21raid5cache randomly fails with NULL pointer accesses > of conf->log when run repeatedly. conf->log was sort of protected with > RCU, but most dereferences were not done with the correct functions. > > Add rcu_read_locks(), rcu_dereference_protected() and rcu_access_pointers() > calls to the appropriate places and mark the pointer with __rcu. Looking at the code a bit more, is this really enough? Calls to r5c_is_writeback / r5c_confi_is_writeback are sprinkled all over the code, and my gut feeling is the value is not expected to change over way longer critical sections than this. So maybe the answer here is to fix up the release to be properly locked as it only affects the non-I/O slow path anyway.