Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp19655ybl; Tue, 7 Jan 2020 13:15:13 -0800 (PST) X-Google-Smtp-Source: APXvYqz7JCfeYnxaqgTOHn4KHb3bhIYB3FDOZvwYQ14vE46cz57n2Gzm3jHJ4mD7xIaue+2msmXF X-Received: by 2002:aca:3cd7:: with SMTP id j206mr377912oia.142.1578431711266; Tue, 07 Jan 2020 13:15:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1578431711; cv=none; d=google.com; s=arc-20160816; b=srXffAeGV32MzXdCooOAyNodj7NVEPwSAwCYoYbIpZVG2F5heBPziIC4odFPUmNSIn pjE1Wa34LxQ+cq7OLy6z3+2whS2wC1gVeA99C/uVUZ0gtdYYGR5gvQfQRPBW93EVfxVX FWmXRgoX3EWH+8RXf4EuRhTj/So9OkMIRM2GzMwjvsGx4+lznt2G1/KMsS3kzPL7oKKa L8TNMrTqoz0fQOeIFfg733oi8a+vxeKBNz2KOV9i1NZuVhswstQ2Q/IOc+GoFNK6oDsY /XaV7GAVrPCas56wasuqGHFcxbWIjK2mXXx6+EtIc7xZmRzqh7GcAfjZCjUbYcOLQcRv U9UA== 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=1dh3eyb3eYJuEb/vg0u1rqoBhMk4y0gT4ECzzzPUQmQ=; b=xddUnAKLvrrz1v2B1qAZVPSiPp7rF+Xg5RZyCyt3rTJcLXS5T3ikAH+og2YiIBBUpE 4sjCJto3EBRaaz7VCZi4s2EmUOk46OpZm+fF23Cegzw179GgHjjSWFnXUZmhlTngtqKG 9X+Jw5fI4NOOtC8qwSxBMii4iiE2d2wu7fqyT/r4yc6DqVRvvWs0DapaP58yVdF3tqr2 8Y2ARkStrOP5Q6ZLo4s2LdHiz/i4RObNQ2UyIZUn+lZ7vV41gmzkJBQjBaJy6OvsOyTZ hZaTeUlY60mtlOejNnPrmQWmwMEClpJVVoeGUuvYbfy1olzRiMT/zAKwc/LCIRJMvCbC tHwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=XdqAWMi4; 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 i6si643145otj.24.2020.01.07.13.14.58; Tue, 07 Jan 2020 13:15:11 -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=XdqAWMi4; 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 S1729532AbgAGVK2 (ORCPT + 99 others); Tue, 7 Jan 2020 16:10:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:36740 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729942AbgAGVKS (ORCPT ); Tue, 7 Jan 2020 16:10:18 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 41ED120880; Tue, 7 Jan 2020 21:10:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578431417; bh=rFSnAJvGaGBJ223eZhfvSst8ZYZ1pjx/lTrwIqMI/eA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XdqAWMi4YtTBrG17Yct+lJuXio8GnsxfRslLpP7T8o0UlHxQ0ysdhe1QZQfpaWJXG Ci2gb2CCxvZTjy9yInWnSnP6rQDBHXaGIOVDnfuneCdE5SS55RbLf93bMGZhImKSq4 gPIfD86CD/ij5MaMYVX1yPViDmjs7mKzb7C+ON8A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Scott Mayhew , "J. Bruce Fields" Subject: [PATCH 4.14 48/74] nfsd4: fix up replay_matches_cache() Date: Tue, 7 Jan 2020 21:55:13 +0100 Message-Id: <20200107205215.249446795@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200107205135.369001641@linuxfoundation.org> References: <20200107205135.369001641@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: Scott Mayhew commit 6e73e92b155c868ff7fce9d108839668caf1d9be upstream. When running an nfs stress test, I see quite a few cached replies that don't match up with the actual request. The first comment in replay_matches_cache() makes sense, but the code doesn't seem to match... fix it. This isn't exactly a bugfix, as the server isn't required to catch every case of a false retry. So, we may as well do this, but if this is fixing a problem then that suggests there's a client bug. Fixes: 53da6a53e1d4 ("nfsd4: catch some false session retries") Signed-off-by: Scott Mayhew Signed-off-by: J. Bruce Fields Signed-off-by: Greg Kroah-Hartman --- fs/nfsd/nfs4state.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c @@ -3058,12 +3058,17 @@ static bool replay_matches_cache(struct (bool)seq->cachethis) return false; /* - * If there's an error than the reply can have fewer ops than - * the call. But if we cached a reply with *more* ops than the - * call you're sending us now, then this new call is clearly not - * really a replay of the old one: + * If there's an error then the reply can have fewer ops than + * the call. */ - if (slot->sl_opcnt < argp->opcnt) + if (slot->sl_opcnt < argp->opcnt && !slot->sl_status) + return false; + /* + * But if we cached a reply with *more* ops than the call you're + * sending us now, then this new call is clearly not really a + * replay of the old one: + */ + if (slot->sl_opcnt > argp->opcnt) return false; /* This is the only check explicitly called by spec: */ if (!same_creds(&rqstp->rq_cred, &slot->sl_cred))