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 5AB69CA9EC9 for ; Mon, 4 Nov 2019 21:49:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 26ABE217F5 for ; Mon, 4 Nov 2019 21:49:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572904159; bh=9qduArsyX3+F16PKcIsoCcFHd0P++Og3KlntLhn8pY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ucA+9oJzF1xxnqqLr9pUJAnY1sdJ+wbJ9KgPTf+2RHajNox5pgodMpPwetfi7477U gdLFvjyO2ZgEbRx8RAD/L6yxEsTUkphUuEDgP1KckVyjNPwgoHX+6jtM3DbplWPGP6 sYCUyJfFrTpplpcBucVkUR0cXhLaJ1auklDH5qDQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730327AbfKDVtS (ORCPT ); Mon, 4 Nov 2019 16:49:18 -0500 Received: from mail.kernel.org ([198.145.29.99]:40470 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730318AbfKDVtR (ORCPT ); Mon, 4 Nov 2019 16:49:17 -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 F1C12214D8; Mon, 4 Nov 2019 21:49:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1572904156; bh=9qduArsyX3+F16PKcIsoCcFHd0P++Og3KlntLhn8pY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qzMpNTxwHtPNdSyS/b2gYizfA9M0L82VkxWMmqpvArHRVfXkkYkw3oJOioX387UWE QyTs2FEXZPkQ1PqxWMdpc4D4k45+LYDTBwRXoSGStjgQCAeOgCVtEtS51UJHDGJubV JtKI4CF1EeecGgJ1Dwe0cVocpghzK8OrE8EQC77w= 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.4 46/46] xfs: Correctly invert xfs_buftarg LRU isolation logic Date: Mon, 4 Nov 2019 22:45:17 +0100 Message-Id: <20191104211918.151678760@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191104211830.912265604@linuxfoundation.org> References: <20191104211830.912265604@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 @@ -1584,7 +1584,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; }