]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
964127935fa0b554bfc7c26fa801b95bbd2a2513
[thirdparty/kernel/stable-queue.git] /
1 From 83f6f6142407850fcb48ad9b05260cb6196fd288 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Mon, 26 Oct 2020 15:19:38 -0700
4 Subject: xfs: set xefi_discard when creating a deferred agfl free log intent
5 item
6
7 From: Darrick J. Wong <darrick.wong@oracle.com>
8
9 [ Upstream commit 2c334e12f957cd8c6bb66b4aa3f79848b7c33cab ]
10
11 Make sure that we actually initialize xefi_discard when we're scheduling
12 a deferred free of an AGFL block. This was (eventually) found by the
13 UBSAN while I was banging on realtime rmap problems, but it exists in
14 the upstream codebase. While we're at it, rearrange the structure to
15 reduce the struct size from 64 to 56 bytes.
16
17 Fixes: fcb762f5de2e ("xfs: add bmapi nodiscard flag")
18 Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
19 Reviewed-by: Brian Foster <bfoster@redhat.com>
20 Signed-off-by: Sasha Levin <sashal@kernel.org>
21 ---
22 fs/xfs/libxfs/xfs_alloc.c | 1 +
23 fs/xfs/libxfs/xfs_bmap.h | 2 +-
24 2 files changed, 2 insertions(+), 1 deletion(-)
25
26 diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c
27 index 1eb7933dac83e..b3a9043b0c9ee 100644
28 --- a/fs/xfs/libxfs/xfs_alloc.c
29 +++ b/fs/xfs/libxfs/xfs_alloc.c
30 @@ -2213,6 +2213,7 @@ xfs_defer_agfl_block(
31 new->xefi_startblock = XFS_AGB_TO_FSB(mp, agno, agbno);
32 new->xefi_blockcount = 1;
33 new->xefi_oinfo = *oinfo;
34 + new->xefi_skip_discard = false;
35
36 trace_xfs_agfl_free_defer(mp, agno, 0, agbno, 1);
37
38 diff --git a/fs/xfs/libxfs/xfs_bmap.h b/fs/xfs/libxfs/xfs_bmap.h
39 index 488dc8860fd7c..50242ba3cdb72 100644
40 --- a/fs/xfs/libxfs/xfs_bmap.h
41 +++ b/fs/xfs/libxfs/xfs_bmap.h
42 @@ -52,9 +52,9 @@ struct xfs_extent_free_item
43 {
44 xfs_fsblock_t xefi_startblock;/* starting fs block number */
45 xfs_extlen_t xefi_blockcount;/* number of blocks in extent */
46 + bool xefi_skip_discard;
47 struct list_head xefi_list;
48 struct xfs_owner_info xefi_oinfo; /* extent owner */
49 - bool xefi_skip_discard;
50 };
51
52 #define XFS_BMAP_MAX_NMAP 4
53 --
54 2.27.0
55