public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: flush delalloc blocks on ENOSPC when creating symlinks
@ 2026-04-15  7:16 Ravi Singh
  2026-04-15  7:20 ` Christoph Hellwig
  0 siblings, 1 reply; 5+ messages in thread
From: Ravi Singh @ 2026-04-15  7:16 UTC (permalink / raw)
  To: linux-xfs, linux-fsdevel; +Cc: djwong, dchinner, esandeen, cem

When creating symlinks on a nearly-full XFS filesystem,
xfs_symlink() fails with ENOSPC even though space could be
reclaimed from speculative preallocations. xfs_create() already
handles this by flushing outstanding delalloc blocks via
xfs_flush_inodes() and retrying the transaction allocation, but
xfs_symlink() returns the error immediately.

Add the same ENOSPC flush+retry logic to xfs_symlink() so that
symlink creation behaves consistently with file creation.

Signed-off-by: Ravi Singh <ravising@redhat.com>
---
 fs/xfs/xfs_symlink.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/xfs/xfs_symlink.c b/fs/xfs/xfs_symlink.c
index c4da624fb296..bf3cf23892eb 100644
--- a/fs/xfs/xfs_symlink.c
+++ b/fs/xfs/xfs_symlink.c
@@ -148,6 +148,12 @@ xfs_symlink(
 
 	error = xfs_trans_alloc_icreate(mp, &M_RES(mp)->tr_symlink, udqp, gdqp,
 			pdqp, resblks, &tp);
+	if (error == -ENOSPC) {
+		/* flush outstanding delalloc blocks and retry */
+		xfs_flush_inodes(mp);
+		error = xfs_trans_alloc_icreate(mp, &M_RES(mp)->tr_symlink,
+				udqp, gdqp, pdqp, resblks, &tp);
+	}
 	if (error)
 		goto out_parent;
 
-- 
2.53.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-16  5:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-15  7:16 [PATCH] xfs: flush delalloc blocks on ENOSPC when creating symlinks Ravi Singh
2026-04-15  7:20 ` Christoph Hellwig
2026-04-15 13:24   ` Ravi Singh
2026-04-15 14:14     ` Eric Sandeen
2026-04-16  5:13     ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox