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 --- 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