Received: by 2002:a25:31c3:0:0:0:0:0 with SMTP id x186csp4463277ybx; Mon, 4 Nov 2019 13:51:02 -0800 (PST) X-Google-Smtp-Source: APXvYqxBTb0/GgIRSjcP+aBbgD2NggwIYWYpaGYCzpsIurs7nbOJH5/Qs1T6+Jm22EFw5w6mNLzS X-Received: by 2002:a50:b4e4:: with SMTP id x33mr152060edd.222.1572904262265; Mon, 04 Nov 2019 13:51:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1572904262; cv=none; d=google.com; s=arc-20160816; b=YOBUbgUAi4TWCpHQkZ8S31Ik56KLPkIzEeqPy1I9Wbit1ip7mmR1K9cSSdRx8agyQV DQmneaCYLxbIo5TmSUzA6vGcK4nT6nMN9PjE1qMYDwrfWQgTN12uXWa2tT8zvHS1skWZ reikB2jBbLKlt31iD5j4UdhYBZSQ9GN6D5WZN3exnCfHgwFpYl+YLoM6fSsjqy59XAcP GaXSFM70todRNuEMflL3WUMxR/5fgdvshpZFaiKnHhEctiyta0EbQi3V4XiRTFNuQTlp cYyY2rWvqJZ2dUuHNBxXezRuKrCzz6wti/kc9ABEe2Z6lN8ZLpCmNlu2uVzsAlQN1AaY 0P/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6mpJ1V5BYEYoUgKxDnDPH7zzo64bx5iMA7IXQt0IeCI=; b=08DE3tZl/LknbELPE2i0brMlMuCxc65BG2Hx3nF7CqRJo6SsMGDSWpS11xUMAyGJkG gpxwRLO0Zr0XeN4Bzeq5eZEz6y5/z2LEv0TmAJfCQjAVQGjHzGl+jgDn4m/XAROtp1+3 0UeL3jQU/ugTeUSG8hQz4CEExj7vieD7trDhPjMx23KHm2KYGyLjguEnf8W9DucGZksG 8Yf173h4KNed5WIVwn3aWHagR9M2Ppb1pr4FLXI+XI8AIhvswL5yY+J3sNeHOSbkKxBJ S8Kf5cfkYUTroc9zx/oHCxN/OwxkAzSBgRvB6jeuQnZ0ux3wy3NvEuK7VEN7fIrvQmKJ Zb+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qzMpNTxw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g11si8782131ejx.212.2019.11.04.13.50.39; Mon, 04 Nov 2019 13:51:02 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qzMpNTxw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730334AbfKDVtS (ORCPT + 99 others); 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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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; }