Re: [PATCH 1/3] xfs: fix per-cpu CIL structure aggregation racing with dying cpus

Darrick J. Wong
2023-08-25T04:08:27Z

On Fri, Aug 25, 2023 at 09:53:04AM +1000, Dave Chinner wrote:
> On Thu, Aug 24, 2023 at 04:21:20PM -0700, Darrick J. Wong wrote:
> > @@ -554,6 +560,7 @@ xlog_cil_insert_items(
> > int iovhdr_res = 0, split_res = 0, ctx_res = 0;
> > int space_used;
> > int order;
> > + unsigned int cpu_nr;
> > struct xlog_cil_pcp *cilpcp;
> >
> > ASSERT(tp);
> > @@ -577,7 +584,12 @@ xlog_cil_insert_items(
> > * can't be scheduled away between split sample/update operations that
> > * are done without outside locking to serialise them.
> > */
> > - cilpcp = get_cpu_ptr(cil->xc_pcp);
> > + cpu_nr = get_cpu();
> > + cilpcp = this_cpu_ptr(cil->xc_pcp);
> > +
> > + /* Tell the future push that there was work added by this CPU. */
> > + if (!cpumask_test_cpu(cpu_nr, &ctx->cil_pcpmask))
> > + cpumask_test_and_set_cpu(cpu_nr, &ctx->cil_pcpmask);
> >
> > /*
> > * We need to take the CIL checkpoint unit reservation on the first
>
> This code also needs the put_cpu_ptr(cil->xc_pcp) converted to
> put_cpu(), even though they end up doing exactly the same thing.
>
> Other than that, it looks good. I'll pull this into my test trees
> and give it a run...

Ok, I'll look forward to seeing what happens. :)

--D

> Cheers,
>
> Dave.
> --
> Dave Chinner
> david@fromorbit.com