From: Darrick J. Wong Date: Fri, 23 Oct 2020 00:03:18 +0000 (-0700) Subject: xfs: set xefi_discard when creating a deferred agfl free log intent item X-Git-Tag: libxfs-5.10-sync-part2_2020-11-16^0 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9b458e2b4b39e67a12f762f74d066650d3160319;p=thirdparty%2Fxfsprogs-dev.git xfs: set xefi_discard when creating a deferred agfl free log intent item Make sure that we actually initialize xefi_discard when we're scheduling a deferred free of an AGFL block. This was (eventually) found by the UBSAN while I was banging on realtime rmap problems, but it exists in the upstream codebase. Fixes: fcb762f5de2e ("xfs: add bmapi nodiscard flag") Signed-off-by: Darrick J. Wong --- diff --git a/libxfs/xfs_alloc.c b/libxfs/xfs_alloc.c index 93043d592..92f61fae4 100644 --- a/libxfs/xfs_alloc.c +++ b/libxfs/xfs_alloc.c @@ -2463,6 +2463,7 @@ xfs_defer_agfl_block( new->xefi_startblock = XFS_AGB_TO_FSB(mp, agno, agbno); new->xefi_blockcount = 1; new->xefi_oinfo = *oinfo; + new->xefi_skip_discard = false; trace_xfs_agfl_free_defer(mp, agno, 0, agbno, 1); diff --git a/libxfs/xfs_bmap.h b/libxfs/xfs_bmap.h index e1bd484e5..6747e97a7 100644 --- a/libxfs/xfs_bmap.h +++ b/libxfs/xfs_bmap.h @@ -52,9 +52,9 @@ struct xfs_extent_free_item { xfs_fsblock_t xefi_startblock;/* starting fs block number */ xfs_extlen_t xefi_blockcount;/* number of blocks in extent */ + bool xefi_skip_discard; struct list_head xefi_list; struct xfs_owner_info xefi_oinfo; /* extent owner */ - bool xefi_skip_discard; }; #define XFS_BMAP_MAX_NMAP 4