Re: [PATCH 3/4] writeback, memcg: Implement cgroup_writeback_by_id()

Tejun Heo
2019-08-15T16:12:16Z

On Thu, Aug 15, 2019 at 04:54:21PM +0200, Jan Kara wrote:
> > + /* and find the associated wb */
> > + wb = wb_get_create(bdi, memcg_css, GFP_NOWAIT | __GFP_NOWARN);
> > + if (!wb) {
> > + ret = -ENOMEM;
> > + goto out_css_put;
> > + }
>
> One more thought: You don't want the "_create" part here, do you? If
> there's any point in writing back using this wb, it must be attached to
> some inode and thus it must exist. In the normal case wb_get_create() will
> just fetch the reference and be done with it but when you feed garbage into
> this function due to id going stale or frn structures getting corrupted due
> to concurrent access, you can be creating bogus wb structures in bdi...

Yeah, it can create wbs unnecessarily which isn't critical but also is
easy to fix. Will update.

Thanks.

--
tejun