]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
xfs: assert that we don't enter agfl freeing with a non-permanent transaction
authorBrian Foster <bfoster@redhat.com>
Tue, 23 Apr 2019 14:54:06 +0000 (07:54 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Tue, 23 Apr 2019 15:36:23 +0000 (08:36 -0700)
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>
fs/xfs/libxfs/xfs_alloc.c

index 857a53e58b9440f14610fa7515883c940d465abd..a9ff3cf82cce0bb0e96bfed46cac5333a6be36ec 100644 (file)
@@ -2243,6 +2243,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)