Re: [PATCH] bdi: Fix another oops in wb_workfn()

From: Linus Torvalds
Date: Wed Jun 13 2018 - 10:55:52 EST

On Wed, Jun 13, 2018 at 7:46 AM Jan Kara <jack@xxxxxxx> wrote:
> On Wed 13-06-18 19:43:47, Tetsuo Handa wrote:
> > Can't we utilize RCU grace period (like shown below) ?
> Honestly, the variant 1 looks too ugly to me. However variant 2 looks
> mostly OK.

The versions that don't have that conditional locking look fine to me, yes.

> Also I'd avoid the addition argument to wb_writeback() and split the function instead. The
> patch resulting from your and mine ideas is attached. Thoughts?

Is there a reason for this model:

+ if (cgwb_start_shutdown(wb))
+ __wb_shutdown(wb);

when there is just one call site of this? Why not just make the
function void, and make it do that __wb_shutdown() itself in the true

IOW, just make it be

+ cgwb_shutdown(wb);


That's what "wb_shutdown()" does - it does the "wb_start_shutdown()"
test internally, and does __wb_shutdown() all inside itself, instead
of expecting the caller to do it.

I dunno.