Re: [PATCH 2/6] xfs: don't double-lock when deleting a self-referential directory

Christoph Hellwig <[email protected]>
Newsgroups org.kernel.vger.linux-xfs,org.kernel.vger.stable
Message-ID <[email protected]>
On Thu, Jul 23, 2026 at 11:21:31PM -0700, Darrick J. Wong wrote:
> -	error = xfs_trans_alloc_dir(dp, &M_RES(mp)->tr_remove, sc->ip,
> -			&resblks, &sc->tp, &dontcare);
> +	if (sc->ip == dp) {
> +again:
> +		error = xfs_trans_alloc_inode(dp, &M_RES(mp)->tr_remove,
> +				resblks, 0, false, &sc->tp);
> +		if ((error == -ENOSPC || error == -EDQUOT) && resblks > 0) {
> +			resblks = 0;
> +			goto again;
> +		}
> +	} else {
> +		error = xfs_trans_alloc_dir(dp, &M_RES(mp)->tr_remove, sc->ip,
> +				&resblks, &sc->tp, &dontcare);

Kinda annoying that the resblks handling is so different between the
two, but we'not going to fix this right now:

Reviewed-by: Christoph Hellwig <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.