From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08F6BCA9ED3 for ; Mon, 4 Nov 2019 22:25:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D0445214E0 for ; Mon, 4 Nov 2019 22:25:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572906325; bh=OyhXsx4XtH2ZdP5pHX68Ev2Em10iwdmYnfxc9c33zyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=wOqUSGAUDgp2rKzZBzPI14rSkM56/HQ5iG9NWheEnLprb5WfSxFVd/WHJLb7yoko1 6ABOeJ+2JD239GJceQxrzoNxKoNfSXcJAnwA8a+i7ZrOhDpiVXecGmjCuOxtalEWKh Qxr0I62sKZ2FvjM8LSHlZuzk+FQb+a6qVC9A5qUc= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388866AbfKDWZY (ORCPT ); Mon, 4 Nov 2019 17:25:24 -0500 Received: from mail.kernel.org ([198.145.29.99]:44854 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730601AbfKDVvq (ORCPT ); Mon, 4 Nov 2019 16:51:46 -0500 Received: from localhost (6.204-14-84.ripe.coltfrance.com [84.14.204.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 676C12053B; Mon, 4 Nov 2019 21:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572904305; bh=OyhXsx4XtH2ZdP5pHX68Ev2Em10iwdmYnfxc9c33zyM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=j1dL2elwqu48LSJwOTtFNzhQeCrHSIaOHS1Xp+gucQrbl/JlUCwbHI42p2YU6iZBg k7BBkNCvSobUguXCGgVgOAHEUS2XLIS8tCDhwUffug3qdnrD+T4agPXEVhBBZOHZq3 p2eHgO2yZhEx3oKMrUaWTAF2QnNQnT0tZVekAFYQ= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Vratislav Bendel , Brian Foster , Christoph Hellwig , "Darrick J. Wong" , Alex Lyakas Subject: [PATCH 4.9 58/62] xfs: Correctly invert xfs_buftarg LRU isolation logic Date: Mon, 4 Nov 2019 22:45:20 +0100 Message-Id: <20191104211959.290977993@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104211901.387893698@linuxfoundation.org> References: <20191104211901.387893698@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Vratislav Bendel commit 19957a181608d25c8f4136652d0ea00b3738972d upstream. Due to an inverted logic mistake in xfs_buftarg_isolate() the xfs_buffers with zero b_lru_ref will take another trip around LRU, while isolating buffers with non-zero b_lru_ref. Additionally those isolated buffers end up right back on the LRU once they are released, because b_lru_ref remains elevated. Fix that circuitous route by leaving them on the LRU as originally intended. Signed-off-by: Vratislav Bendel Reviewed-by: Brian Foster Reviewed-by: Christoph Hellwig Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Alex Lyakas Signed-off-by: Greg Kroah-Hartman --- fs/xfs/xfs_buf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/xfs/xfs_buf.c +++ b/fs/xfs/xfs_buf.c @@ -1674,7 +1674,7 @@ xfs_buftarg_isolate( * zero. If the value is already zero, we need to reclaim the * buffer, otherwise it gets another trip through the LRU. */ - if (!atomic_add_unless(&bp->b_lru_ref, -1, 0)) { + if (atomic_add_unless(&bp->b_lru_ref, -1, 0)) { spin_unlock(&bp->b_lock); return LRU_ROTATE; }