From b76322164010e588d0a9a4831f7e275a4d32593b Mon Sep 17 00:00:00 2001 From: Pan Bian Date: Wed, 12 Dec 2018 08:46:20 -0800 Subject: [PATCH] xfs: libxfs: move xfs_perag_put late commit fe5ed6c22e94b131ed5608d66ebce1efc39a7edb upstream. The function xfs_alloc_get_freelist calls xfs_perag_put to drop the reference. However, pag->pagf_btreeblks is read and written after the put operation. This patch moves the put operation later. Signed-off-by: Pan Bian Reviewed-by: Carlos Maiolino [darrick: minor changelog edits] Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Joseph Qi Reviewed-by: Xiaoguang Wang --- fs/xfs/libxfs/xfs_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index e1c0c0d2f1b0..4be387de8294 100644 --- a/fs/xfs/libxfs/xfs_alloc.c +++ b/fs/xfs/libxfs/xfs_alloc.c @@ -2435,7 +2435,6 @@ xfs_alloc_get_freelist( be32_add_cpu(&agf->agf_flcount, -1); xfs_trans_agflist_delta(tp, -1); pag->pagf_flcount--; - xfs_perag_put(pag); logflags = XFS_AGF_FLFIRST | XFS_AGF_FLCOUNT; if (btreeblk) { @@ -2443,6 +2442,7 @@ xfs_alloc_get_freelist( pag->pagf_btreeblks++; logflags |= XFS_AGF_BTREEBLKS; } + xfs_perag_put(pag); xfs_alloc_log_agf(tp, agbp, logflags); *bnop = bno; -- GitLab