Re: [PATCH 3/4] xfs: handle allocation failure in xfs_dquot_disk_alloc()

Darrick J. Wong
2024-04-03T04:54:57Z

On Tue, Apr 02, 2024 at 09:41:56PM -0700, Christoph Hellwig wrote:
> > + if (nmaps == 0) {
> > + /*
> > + * Unexpected ENOSPC - the transaction reservation should have
> > + * guaranteed that this allocation will succeed. We don't know
> > + * why this happened, so just back out gracefully.
> > + *
> > + * We commit the transaction instead of cancelling it as it may
> > + * be dirty due to extent count upgrade. This avoids a potential
> > + * filesystem shutdown when this happens. We ignore any error
> > + * from the transaction commit - we always return -ENOSPC to the
> > + * caller here so we really don't care if the commit fails for
> > + * some unknown reason...
> > + */
> > + xfs_trans_commit(tp);
> > + return -ENOSPC;
>
> A cancel and thus shutdown does seem like the right behavior for a trap
> for an unknown bug..

Usually this will result in the file write erroring out, right?

--D