RE: [PATCH V5 10/17] scsi: ufs: manually add well known logical units

Subhash Jadavani
2014-09-24T16:59:07Z

> Just after the call to scsi_remove_host sounds right to me.
> scsi_remove_host already removes all regularly scanned devices, but
because __scsi_add_device keeps and additional reference it doesn't free
those that you added manually.

Ok, we are calling scsi_remove_host() as part of ufs driver removal so we
can remove these manually added devices immediately after it. Next patch
revision should fix it.

-----Original Message-----
From: 'Christoph Hellwig' [mailto:hch@infradead.org]
Sent: Wednesday, September 24, 2014 9:41 AM
To: Subhash Jadavani
Cc: 'Christoph Hellwig'; 'Dolev Raviv';
James.Bottomley@HansenPartnership.com; linux-scsi@vger.kernel.org;
linux-scsi-owner@vger.kernel.org; linux-arm-msm@vger.kernel.org;
santoshsy@gmail.com; 'Sujit Reddy Thumma'
Subject: Re: [PATCH V5 10/17] scsi: ufs: manually add well known logical
units

On Wed, Sep 24, 2014 at 09:36:37AM -0700, Subhash Jadavani wrote:
> Where do you release these references again? It seems like they are
> never released on the device removal path.
>
> [Subhash] That's because these are embedded/non-removable UFS devices
> which are always present on the board and never get removed. Do you
> have any suggestion on how we should handle this?

Just after the call to scsi_remove_host sounds right to me.
scsi_remove_host already removes all regularly scanned devices, but because
__scsi_add_device keeps and additional reference it doesn't free those that
you added manually.