From: Pan Bian Date: Wed, 12 Dec 2018 16:46:20 +0000 (-0800) Subject: xfs: libxfs: move xfs_perag_put late X-Git-Tag: v5.4-rc1~1853^2~24 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe5ed6c22e94b131ed5608d66ebce1efc39a7edb;p=platform%2Fkernel%2Flinux-rpi.git xfs: libxfs: move xfs_perag_put late 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 --- diff --git a/fs/xfs/libxfs/xfs_alloc.c b/fs/xfs/libxfs/xfs_alloc.c index e1c0c0d..4be387d 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;