Re: [PATCH] ext4: clear error before retrying inode xattr space fallback
From: Jan Kara
Date: Thu Jul 09 2026 - 09:46:52 EST
On Wed 08-07-26 12:57:19, Guanghui Yang wrote:
> When ext4_xattr_make_inode_space() returns -ENOSPC,
> ext4_expand_extra_isize_ea() can retry the expansion with
> s_min_extra_isize. If that retry succeeds by finding enough ibody free
> space, control jumps directly to the shift label.
>
> The previous -ENOSPC is still stored in error in that path, so the
> function can update i_extra_isize but still return -ENOSPC to the
> caller. Clear error before retrying so a successful fallback expansion
> returns success.
>
> Reproduced with an ext4 image using 1 KiB blocks, project quota support,
> 256-byte inodes, and min_extra_isize/want_extra_isize set to 32.
> FS_IOC_FSSETXATTR failures dropped from 802 to 86 after the fix.
>
> Fixes: 69f3a3039b0d ("ext4: introduce ITAIL helper")
> Cc: stable@xxxxxxxxxxxxxxx
> Signed-off-by: Guanghui Yang <3497809730@xxxxxx>
Indeed. Feel free to add:
Reviewed-by: Jan Kara <jack@xxxxxxx>
Honza
> ---
> fs/ext4/xattr.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
> index 982a1f831e22..9da5dfcea7b8 100644
> --- a/fs/ext4/xattr.c
> +++ b/fs/ext4/xattr.c
> @@ -2839,6 +2839,7 @@ int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize,
> s_min_extra_isize) {
> tried_min_extra_isize++;
> new_extra_isize = s_min_extra_isize;
> + error = 0;
> goto retry;
> }
> goto cleanup;
> --
> 2.34.1
>
--
Jan Kara <jack@xxxxxxxx>
SUSE Labs, CR