]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob
b198476ff75f8680fbbc8ca5146157933a737183
[thirdparty/kernel/stable-queue.git] /
1 From 7d092328e4b3c551753675b00f7c910c3636f577 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 852b536551b53..15640015be9d2 100644
28 --- a/fs/xfs/libxfs/xfs_alloc.c
29 +++ b/fs/xfs/libxfs/xfs_alloc.c
30 @@ -2467,6 +2467,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 e1bd484e55485..6747e97a79490 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