Re: [PATCH 07/19] Fix RCU handling of scsi_device.vpd_pg8[03]

Bart Van Assche
2017-08-24T16:54:58Z

On Thu, 2017-08-24 at 11:07 +0200, Christoph Hellwig wrote:
> On Wed, Aug 23, 2017 at 02:39:57PM -0700, Bart Van Assche wrote:
> > Only annotate pointers that are shared across threads with __rcu.
> > Use rcu_dereference() when dereferencing an RCU pointer. Protect
> > also the RCU pointer dereferences when freeing RCU pointers. This
> > patch suppresses about twenty sparse complaints about the vpd_pg8[03]
> > pointers.
>
> Shouldn't the kfrees be kfree_rcu? or where else is the rcu protection
> for them?

Hello Christoph,

My understanding of the SCSI VPD code is as follows:
* rcu_read_lock() / rcu_read_unlock() is used to prevent that another thread
updates a VPD buffer while it is being read.
* All code that either updates or reads a VPD buffer holds a reference on
the SCSI device that buffer is associated with. That is why I think it is
not needed to use kfree_rcu() in scsi_device_dev_release_usercontext().

Bart.