mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-11 21:38:32 +08:00
1ca89fbc48
The block allocation AG selection code has parameters that allow a caller to perform multiple allocations from a single AG and transaction (under certain conditions). The parameters specify the total block allocation count required by the transaction and the AG selection code selects and locks an AG that will be able to satisfy the overall requirement. If the available block accounting calculation turns out to be inaccurate and a subsequent allocation call fails with -ENOSPC, the resulting transaction cancel leads to filesystem shutdown because the transaction is dirty. This exact problem can be reproduced with a highly parallel space consumer and fsstress workload running long enough to a large filesystem against -ENOSPC conditions. A bmbt block allocation request made for inode extent to bmap format conversion after an extent allocation is expected to be satisfied by the same AG and the same transaction as the extent allocation. The bmbt block allocation fails, however, because the block availability of the AG has changed since the AG was selected (outside of the blocks used for the extent itself). The inconsistent block availability calculation is caused by the deferred block freeing behavior of the AGFL. This immediately removes extra blocks from the AGFL to free up AGFL slots, but rather than immediately freeing such blocks as was done in the past, the block free is deferred such that said blocks are not available for allocation until the current transaction commits. The AG selection logic currently considers all AGFL blocks as available and executes shortly before any extra AGFL blocks are freed. This means the block availability of the current AG can change before the first allocation even occurs, but in practice a failure is more likely to manifest via a subsequent allocation because extent allocation usually has a contiguity requirement larger than a single block that can't be satisfied from the AGFL. In general, XFS prefers operational robustness to absolute allocation efficiency. In other words, we prefer to return -ENOSPC slightly earlier at the expense of not being able to allocate every last block in an AG to avoid this kind of problem. As such, update the AG block availability calculation to consider extra AGFL blocks as unavailable since they are immediately removed following the calculation and will not become available until the current transaction commits. Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> |
||
---|---|---|
.. | ||
xfs_ag_resv.c | ||
xfs_ag_resv.h | ||
xfs_ag.c | ||
xfs_ag.h | ||
xfs_alloc_btree.c | ||
xfs_alloc_btree.h | ||
xfs_alloc.c | ||
xfs_alloc.h | ||
xfs_attr_leaf.c | ||
xfs_attr_leaf.h | ||
xfs_attr_remote.c | ||
xfs_attr_remote.h | ||
xfs_attr_sf.h | ||
xfs_attr.c | ||
xfs_attr.h | ||
xfs_bit.c | ||
xfs_bit.h | ||
xfs_bmap_btree.c | ||
xfs_bmap_btree.h | ||
xfs_bmap.c | ||
xfs_bmap.h | ||
xfs_btree.c | ||
xfs_btree.h | ||
xfs_cksum.h | ||
xfs_da_btree.c | ||
xfs_da_btree.h | ||
xfs_da_format.c | ||
xfs_da_format.h | ||
xfs_defer.c | ||
xfs_defer.h | ||
xfs_dir2_block.c | ||
xfs_dir2_data.c | ||
xfs_dir2_leaf.c | ||
xfs_dir2_node.c | ||
xfs_dir2_priv.h | ||
xfs_dir2_sf.c | ||
xfs_dir2.c | ||
xfs_dir2.h | ||
xfs_dquot_buf.c | ||
xfs_errortag.h | ||
xfs_format.h | ||
xfs_fs.h | ||
xfs_ialloc_btree.c | ||
xfs_ialloc_btree.h | ||
xfs_ialloc.c | ||
xfs_ialloc.h | ||
xfs_iext_tree.c | ||
xfs_inode_buf.c | ||
xfs_inode_buf.h | ||
xfs_inode_fork.c | ||
xfs_inode_fork.h | ||
xfs_log_format.h | ||
xfs_log_recover.h | ||
xfs_log_rlimit.c | ||
xfs_quota_defs.h | ||
xfs_refcount_btree.c | ||
xfs_refcount_btree.h | ||
xfs_refcount.c | ||
xfs_refcount.h | ||
xfs_rmap_btree.c | ||
xfs_rmap_btree.h | ||
xfs_rmap.c | ||
xfs_rmap.h | ||
xfs_rtbitmap.c | ||
xfs_sb.c | ||
xfs_sb.h | ||
xfs_shared.h | ||
xfs_symlink_remote.c | ||
xfs_trans_resv.c | ||
xfs_trans_resv.h | ||
xfs_trans_space.h | ||
xfs_types.c | ||
xfs_types.h |