Skip to content

Commit 2c334e1

Browse files
committed
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. While we're at it, rearrange the structure to reduce the struct size from 64 to 56 bytes. Fixes: fcb762f ("xfs: add bmapi nodiscard flag") Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com>
1 parent 3650b22 commit 2c334e1

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

fs/xfs/libxfs/xfs_alloc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,6 +2467,7 @@ xfs_defer_agfl_block(
24672467
new->xefi_startblock = XFS_AGB_TO_FSB(mp, agno, agbno);
24682468
new->xefi_blockcount = 1;
24692469
new->xefi_oinfo = *oinfo;
2470+
new->xefi_skip_discard = false;
24702471

24712472
trace_xfs_agfl_free_defer(mp, agno, 0, agbno, 1);
24722473

fs/xfs/libxfs/xfs_bmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ struct xfs_extent_free_item
5252
{
5353
xfs_fsblock_t xefi_startblock;/* starting fs block number */
5454
xfs_extlen_t xefi_blockcount;/* number of blocks in extent */
55+
bool xefi_skip_discard;
5556
struct list_head xefi_list;
5657
struct xfs_owner_info xefi_oinfo; /* extent owner */
57-
bool xefi_skip_discard;
5858
};
5959

6060
#define XFS_BMAP_MAX_NMAP 4

0 commit comments

Comments
 (0)