mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
xfs: flush delalloc blocks on ENOSPC in xfs_trans_alloc_icreate
xfs_trans_alloc_icreate() can fail with ENOSPC when delalloc reservations have consumed most of the available block count (fdblocks). xfs_trans_alloc() already retries internally with xfs_blockgc_flush_all(), but that only trims post-EOF speculative preallocation and may not free enough space for the transaction reservation. Add a retry with xfs_flush_inodes() when xfs_trans_alloc() returns ENOSPC. This forces writeback of all dirty inodes via sync_inodes_sb(), converting delalloc reservations to real allocations and freeing the over-reserved portion back to fdblocks. This fixes all callers of xfs_trans_alloc_icreate() and removes the existing caller-level retry from xfs_create(), which is now handled centrally. Signed-off-by: Ravi Singh <ravising@redhat.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
parent
fca20fcb76
commit
87e63466c9
|
|
@ -699,12 +699,6 @@ xfs_create(
|
|||
*/
|
||||
error = xfs_trans_alloc_icreate(mp, tres, udqp, gdqp, pdqp, resblks,
|
||||
&tp);
|
||||
if (error == -ENOSPC) {
|
||||
/* flush outstanding delalloc blocks and retry */
|
||||
xfs_flush_inodes(mp);
|
||||
error = xfs_trans_alloc_icreate(mp, tres, udqp, gdqp, pdqp,
|
||||
resblks, &tp);
|
||||
}
|
||||
if (error)
|
||||
goto out_parent;
|
||||
|
||||
|
|
|
|||
|
|
@ -1199,10 +1199,21 @@ xfs_trans_alloc_icreate(
|
|||
{
|
||||
struct xfs_trans *tp;
|
||||
bool retried = false;
|
||||
bool flushed = false;
|
||||
int error;
|
||||
|
||||
retry:
|
||||
error = xfs_trans_alloc(mp, resv, dblocks, 0, 0, &tp);
|
||||
if (error == -ENOSPC && !flushed) {
|
||||
/*
|
||||
* Flush all delalloc blocks to reclaim space from speculative
|
||||
* preallocation. This is similar to the quota retry below
|
||||
* but targets FS-wide ENOSPC.
|
||||
*/
|
||||
xfs_flush_inodes(mp);
|
||||
flushed = true;
|
||||
goto retry;
|
||||
}
|
||||
if (error)
|
||||
return error;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user