Re: [PATCH 3/8] bdi: add a ->dev_name field to struct backing_dev_info
From: Jan Kara
Date: Mon Apr 20 2020 - 05:52:23 EST
On Mon 20-04-20 09:48:01, Christoph Hellwig wrote:
> On Sun, Apr 19, 2020 at 06:06:51PM +0200, Christoph Hellwig wrote:
> > > (https://lore.kernel.org/linux-block/20200416071519.807660-4-hch@xxxxxx/)
> > > and also to the replies to that patch? This is what I found in the replies:
> > > "When driver try to to re-register bdi but without release_bdi(), the old
> > > dev_name will be cover directly by the newer in bdi_register_va(). So, I am
> > > not sure whether it can cause memory leak for bdi->dev_name."
> > >
> > > Has it been considered to avoid that leak by freeing bdi->dev_name from
> > > unregister_bdi(), e.g. as follows?
> >
> > We'd need some protection against concurrent accesses as unregister_bdi
> > can race with them. But with RCU that could be handled, so let me try
> > that.
>
> I looked into it, and while it seems doable I think this goes in the
> wrong direction as it pushed the RCU knowledge into the callers. I'd
> rather get something like this series in ASAP, and then for 5.8 or 5.9
> move the bdi pointer to the gendisk and stop re-registering it and thus
> solve the problems root cause for real.
Yeah, if it could be done it would be a nice solution. Because
re-registering of BDIs is a long-term source of troubles...
Honza
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR