Re: [PATCH v2] sched/psi: fix race between file release and pressure write
From: Edward Adam Davis
Date: Sat Apr 11 2026 - 22:37:01 EST
On Sat, 11 Apr 2026 10:40:13 -1000, Tejun Heo wrote:
> On Sat, Apr 11, 2026 at 04:29:22PM +0800, Edward Adam Davis wrote:
> > On Fri, 10 Apr 2026 21:39:49 -1000, Tejun Heo wrote:
> > > > > > + ctx = of->priv;
> > > > > > + if (!ctx) {
> > > > >
> > > > > This test likely isn't necessary but that's pre-existing.
> > > > Where?
> > > > Are you referring to the check for of->released within:
> > >
> > > No, I'm talking about of->priv. I don't think it can be NULL while a live
> > > cgroup kn is locked, can it?
> >
> > If the lock is acquired before the execution of cgroup_file_release()
> > completes, it will not be NULL; however, if acquired afterwards, it
> > will invariably be NULL.
>
> Hmmm? While the write is in flight the file can't be released and the cgroup
> couldn't have been dead if lock_live succeeded. This part is tangential
> anyway. Let's ignore for now.
I have once again walked through the entire workflow for the cgroup
deletion operation. Indeed, if the active kn lock can be successfully
acquired while executing pressure write, it indicates that the cgroup
deletion process has not yet reached its final stage; therefore, the
`priv` pointer within open_file cannot possibly be NULL.
I will submit the third version of the patch shortly.
Edward
BR