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

Dave Chinner
2024-04-03T06:41:39Z

On Tue, Apr 02, 2024 at 10:04:30PM -0700, Darrick J. Wong wrote:
> On Tue, Apr 02, 2024 at 09:56:24PM -0700, Christoph Hellwig wrote:
> > On Tue, Apr 02, 2024 at 09:54:56PM -0700, Darrick J. Wong wrote:
> > > Usually this will result in the file write erroring out, right?
> >
> > quota file allocations usually come originally from a file write or
> > inode creation. But I'm not entirely sure if that was the question..
>
> Heh, and the question was based on a misreading of your comment. 8-)
>
> AFAICT this can result in dqattach erroring out, which seems mostly
> benign.

Right - this propagates the ENOSPC error back to the caller without
a shutdown being required. If we get a corruption detected, then
the allocation will return an error, not nmaps == 0. That error will
cause a corruption. But an unexpected allocation failure right at
ENOSPC can occur without there being corruption because of, say, one
of the many, many near ENOSPC accounting bugs we've had to fix
over the past 20 years, and if the allocation fails we should just
clean up and return -ENOSPC without shutting down the filesystem.
We're right at ENOSPC, so there's every chance that the next
operation after the dquot was attached would fail with ENOSPC
anyway....

So, yeah, I don't see any reason to shut the filesytsem down because
we ended up with a transient ENOSPC error or an off-by one in the
free space accounting somewhere...

-Dave.
--
Dave Chinner
david@fromorbit.com