Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

xfs: assert that we don't enter agfl freeing with a non-permanent transaction

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 <darrick.wong@oracle.com>
Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
[darrick: split this out from the previous patch per hch request]
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>

authored by

Brian Foster and committed by
Darrick J. Wong
362f5e74 945c941f

+3
+3
fs/xfs/libxfs/xfs_alloc.c
··· 2243 2243 xfs_extlen_t need; /* total blocks needed in freelist */ 2244 2244 int error = 0; 2245 2245 2246 + /* deferred ops (AGFL block frees) require permanent transactions */ 2247 + ASSERT(tp->t_flags & XFS_TRANS_PERM_LOG_RES); 2248 + 2246 2249 if (!pag->pagf_init) { 2247 2250 error = xfs_alloc_read_agf(mp, tp, args->agno, flags, &agbp); 2248 2251 if (error)