From: Ravi Singh <ravising@redhat.com>
To: linux-xfs@vger.kernel.org, linux-fsdevel@vger.kernel.org
Cc: djwong@kernel.org, dchinner@redhat.com, esandeen@redhat.com,
cem@kernel.org
Subject: [PATCH] xfs: flush delalloc blocks on ENOSPC when creating symlinks
Date: Wed, 15 Apr 2026 07:16:57 +0000 [thread overview]
Message-ID: <20260415071657.23412-1-ravising@redhat.com> (raw)
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
next reply other threads:[~2026-04-15 7:17 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-15 7:16 Ravi Singh [this message]
2026-04-15 7:20 ` [PATCH] xfs: flush delalloc blocks on ENOSPC when creating symlinks Christoph Hellwig
2026-04-15 13:24 ` Ravi Singh
2026-04-15 14:14 ` Eric Sandeen
2026-04-16 5:13 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260415071657.23412-1-ravising@redhat.com \
--to=ravising@redhat.com \
--cc=cem@kernel.org \
--cc=dchinner@redhat.com \
--cc=djwong@kernel.org \
--cc=esandeen@redhat.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox