• B
    xfs: account finobt blocks properly in perag reservation · ad90bb58
    Brian Foster 提交于
    XFS started using the perag metadata reservation pool for free inode
    btree blocks in commit 76d771b4 ("xfs: use per-AG reservations
    for the finobt"). To handle backwards compatibility, finobt blocks
    are accounted against the pool so long as the full reservation is
    available at mount time. Otherwise the ->m_inotbt_nores flag is set
    and the filesystem falls back to the traditional per-transaction
    finobt reservation.
    
    This commit has two problems:
    
    - finobt blocks are always accounted against the metadata
      reservation on allocation, regardless of ->m_inotbt_nores state
    - finobt blocks are never returned to the reservation pool on free
    
    The first problem affects reflink+finobt filesystems where the full
    finobt reservation is not available at mount time. finobt blocks are
    essentially stolen from the reflink reservation, putting refcountbt
    management at risk of allocation failure. The second problem is an
    unconditional leak of metadata reservation whenever finobt is
    enabled.
    
    Update the finobt block allocation callouts to consider
    ->m_inotbt_nores and account blocks appropriately. Blocks should be
    consistently accounted against the metadata pool when
    ->m_inotbt_nores is false and otherwise tagged as RESV_NONE.
    Signed-off-by: NBrian Foster <bfoster@redhat.com>
    Reviewed-by: NDarrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: NDarrick J. Wong <darrick.wong@oracle.com>
    ad90bb58
xfs_ialloc_btree.c 15.0 KB