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 a7ba1594e00097195589b8252c7bfa052b884ff3.
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: a7ba1594e000 ("xfs: Fix file creation failure") Signed-off-by: Zizhi Wo wozizhi@huawei.com --- fs/xfs/libxfs/xfs_alloc.c | 14 -------------- fs/xfs/libxfs/xfs_alloc_btree.c | 9 +-------- fs/xfs/libxfs/xfs_btree.h | 1 - 3 files changed, 1 insertion(+), 23 deletions(-)
diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index 4dd3238161cf..6e448f50cef4 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c @@ -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. diff --git a/fs/xfs/libxfs/xfs_alloc_btree.c b/fs/xfs/libxfs/xfs_alloc_btree.c index d2c7a217a74b..c65228efed4a 100644 --- a/fs/xfs/libxfs/xfs_alloc_btree.c +++ b/fs/xfs/libxfs/xfs_alloc_btree.c @@ -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; diff --git a/fs/xfs/libxfs/xfs_btree.h b/fs/xfs/libxfs/xfs_btree.h index bf63bbcd4914..4d68a58be160 100644 --- a/fs/xfs/libxfs/xfs_btree.h +++ b/fs/xfs/libxfs/xfs_btree.h @@ -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 */