From: Brian Foster Date: Wed, 24 Jul 2019 19:54:06 +0000 (-0400) Subject: xfs: assert that we don't enter agfl freeing with a non-permanent transaction X-Git-Tag: v5.2.0-rc0~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d85d3424765db52017302c54a352d3d51fe8755d;p=thirdparty%2Fxfsprogs-dev.git xfs: assert that we don't enter agfl freeing with a non-permanent transaction Source kernel commit: 362f5e745ae2ee2be9cf181b3a22917d619b81a1 Block allocation requires a permanent transaction for deferred AGFL frees. Add an assert in the block allocation path to make explicit and obvious to future callers the requirement of a transaction with a permanent reservation. Reported-by: Darrick J. Wong Signed-off-by: Brian Foster Reviewed-by: Darrick J. Wong [darrick: split this out from the previous patch per hch request] Signed-off-by: Darrick J. Wong Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c index d440e4195..e21c78853 100644 --- a/libxfs/xfs_alloc.c +++ b/libxfs/xfs_alloc.c @@ -2239,6 +2239,9 @@ xfs_alloc_fix_freelist( xfs_extlen_t need; /* total blocks needed in freelist */ int error = 0; + /* deferred ops (AGFL block frees) require permanent transactions */ + ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); + if (!pag->pagf_init) { error = xfs_alloc_read_agf(mp, tp, args->agno, flags, &agbp); if (error)