Re: [RFC PATCH 1/2] xfs: free the item in xfs_mru_cache_insert on failure

From: hch
Date: Mon May 05 2025 - 01:46:04 EST


On Fri, May 02, 2025 at 01:06:46PM -0700, Darrick J. Wong wrote:
> > atomic_inc(&pag_group(args->pag)->xg_active_ref);
> > item->pag = args->pag;
> > - error = xfs_mru_cache_insert(mp->m_filestream, pino, &item->mru);
> > - if (error)
> > - goto out_free_item;
> > + xfs_mru_cache_insert(mp->m_filestream, pino, &item->mru);
>
> Hmm, don't you still need to check for -ENOMEM returns? Or if truly
> none of the callers care anymore, then can we get rid of the return
> value for xfs_mru_cache_insert?

Both for file streams and the zone association in the next patch the
mru cache is just a hint, so we ignore all errors (see the return 0
in the error handling boilerplate in the existing code). But hardcoding
that assumption into the core mru cache helpers seems a bit weird.