Commit 9d47d9aa authored by Zizhi Wo's avatar Zizhi Wo
Browse files

Revert "xfs: Fix file creation failure"

maillist inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I9TDTA
CVE: NA

Reference: https://lore.kernel.org/all/20240701060236.2221400-1-wozizhi@huawei.com/



--------------------------------

This reverts commit a7ba1594.

The fix for this issue has been approved by the community, so revert the
previous commit and incorporating the latest solution in a later patch.

Fixes: a7ba1594 ("xfs: Fix file creation failure")
Signed-off-by: default avatarZizhi Wo <wozizhi@huawei.com>
parent ddbb3ee7
Loading
Loading
Loading
Loading
+0 −14
Original line number Diff line number Diff line
@@ -586,13 +586,6 @@ xfs_alloc_fixup_trees(
		nfbno2 = rbno + rlen;
		nflen2 = (fbno + flen) - nfbno2;
	}

	/*
	 * Record the potential maximum free length in advance.
	 */
	if (nfbno1 != NULLAGBLOCK || nfbno2 != NULLAGBLOCK)
		cnt_cur->bc_ag.bc_free_longest = XFS_EXTLEN_MAX(nflen1, nflen2);

	/*
	 * Delete the entry from the by-size btree.
	 */
@@ -2026,13 +2019,6 @@ xfs_free_ag_extent(
	 * Now allocate and initialize a cursor for the by-size tree.
	 */
	cnt_cur = xfs_allocbt_init_cursor(mp, tp, agbp, pag, XFS_BTNUM_CNT);
	/*
	 * Record the potential maximum free length in advance.
	 */
	if (haveleft)
		cnt_cur->bc_ag.bc_free_longest = ltlen;
	if (haveright)
		cnt_cur->bc_ag.bc_free_longest = gtlen;
	/*
	 * Have both left and right contiguous neighbors.
	 * Merge all three into a single free block.
+1 −8
Original line number Diff line number Diff line
@@ -146,14 +146,7 @@ xfs_allocbt_update_lastrec(
			rrp = XFS_ALLOC_REC_ADDR(cur->bc_mp, block, numrecs);
			len = rrp->ar_blockcount;
		} else {
			/*
			 * Update in advance to prevent file creation failure
			 * for concurrent processes even though there is no
			 * numrec currently.
			 * And there's no need to worry as the value that no
			 * less than bc_free_longest will be inserted later.
			 */
			len = cpu_to_be32(cur->bc_ag.bc_free_longest);
			len = 0;
		}

		break;
+0 −1
Original line number Diff line number Diff line
@@ -218,7 +218,6 @@ union xfs_btree_irec {
/* Per-AG btree information. */
struct xfs_btree_cur_ag {
	struct xfs_perag		*pag;
	xfs_extlen_t			bc_free_longest; /* the potential longest free extent */
	union {
		struct xfs_buf		*agbp;
		struct xbtree_afakeroot	*afake;	/* for staging cursor */