Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp668538ybt; Wed, 8 Jul 2020 08:52:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwZDm+Hy11hSKpObvKPAP4TXvooEoBP/+S9lEH7hMuLZDmnN5DVkpvKxACrnYu8IixPamT X-Received: by 2002:a05:6402:1841:: with SMTP id v1mr54328375edy.198.1594223521328; Wed, 08 Jul 2020 08:52:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594223521; cv=none; d=google.com; s=arc-20160816; b=eDLH7vX7496kcSDjGDhYY3FRiSHFJxnc4UsgOzmHNRIlT9seNuxqJR9iHU02p74hx7 yQBvj0O4ctTN1ok/E1XmO0qSRdYRv/JVld9wczNclGFOAK6xELIg5VHHXE7ldKhNL7vQ f1CWc2ymsqyY+We/nm0HENWIQNaSGKGqg8x0HX5TrS69LZp2rmxwgbQ9LMRXVf81XFkC ncqKKIiM6WiOEKq2FBU1Nql2ZwERJv8GBAsu3B8VJXGQYKY/1mREsftavSFE14XtLBB+ PjgHTS8IAY3AH8Ux5S36VWVS8lIpfZJk3vm4oRHEg1dkafaFiDkLZBXM/B26ePrm8LuE SWuw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UMXumYlEHiWgHY3PeWGbuEe5vvQlvPkNCx3e1sy12ME=; b=qJD1N25nXwN+BTsqEV9raF012eJq5YoCfo9re34YLyC2oCwiL6qfPgopfbb/2khjQx kmgZjIV/AZSUPmWwlQ6KWG5Ibv3z17QAZfyPE0e1F9viohaQ5xxxS2VXX8Scm1eFvKM+ VSIIreIRBOUTt4808IoRvhh6xdYHOvrLB/4u8Da1rj0sFYwwegy8T5PE0nArY/eTp2rY fUJXHdfpfbX/xrRFIPgyNBN3o5UbnDjGN9zBs9h5oC49tF9b7BQaITn+vnCT+XyBQuME dD2ykjo95O6m3zjnYQsWouQ3RNGZq609Lh4bDiPbsvbMZ20ArJHCSFSZAgxAXwcUsgtw 9CSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=uxR3sp5P; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id w13si108581ejj.564.2020.07.08.08.51.37; Wed, 08 Jul 2020 08:52:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=uxR3sp5P; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730387AbgGHPuW (ORCPT + 99 others); Wed, 8 Jul 2020 11:50:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729022AbgGHPuW (ORCPT ); Wed, 8 Jul 2020 11:50:22 -0400 Received: from mail-qk1-x743.google.com (mail-qk1-x743.google.com [IPv6:2607:f8b0:4864:20::743]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D825C061A0B for ; Wed, 8 Jul 2020 08:50:22 -0700 (PDT) Received: by mail-qk1-x743.google.com with SMTP id 80so41968191qko.7 for ; Wed, 08 Jul 2020 08:50:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=UMXumYlEHiWgHY3PeWGbuEe5vvQlvPkNCx3e1sy12ME=; b=uxR3sp5P+YMISuGSI5ev32RdKSNRNtHRAGS1XnVY7p7A5CrPHVLucobANQEIO6IDyF T1J+zlHjuZvlEkxfDSMJ3bYeNBd5bede0PqQmbNnLf+e8VQgeOdtAqgGEpQumjApUzeO SrorMTGlx1iWa7fEdlewPAtpBylS/CMloVABsKYQgpeUp1m1zNo25IBzcCdlr04RbY9J r69B3WVxb+ih6/gJD4PTzjih91JQnZ5djY21LhR0BzI1eVQTeNi1fUEScgM/UNixYFIU 4jPhxPVjoBplkOELvBkIpmM/HwUibM/JHICytHggm7IQbhzF+lyRUdMKBQt4zFwbzKiq Zi2A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=UMXumYlEHiWgHY3PeWGbuEe5vvQlvPkNCx3e1sy12ME=; b=d35VbrVauvmqTas3Rh0u7m3uQgSOUYkPbsssYs4jUhic5ujp0baq4K2F4def2gxWQU UFGN2oiS/jUFtjxdggHtphtDgzx+SpJAN1rOBYsbrKBuI2t1HpKxZmG01H1901a8WpW2 iLVsCEpVdVupz4b2R+nsvw8hpiGmIZqeQXtezrDM90ha3v+xOikfaPr0X71GlMDcYqkY A0pxZkwOhT3UMzmkUBfeceO6V+HD3AY5FkH3Ni1mXUk7HfKUpVmIFmEii9ocnvMeG/YI 8eYVIBkXfwaeVoKZn2zkZJKhJbUyEWnN+kibxVMyCHMtkEJs61j9QoGexzXnCY313kzn oeLA== X-Gm-Message-State: AOAM531tXH+IBNVcdcVt1/UqV2mQm2w7BmXq1OWns5tmE7c3Qv37CSO4 84JuawMtbOTQQtkjWWAwhtj5xuNA X-Received: by 2002:a05:620a:40c1:: with SMTP id g1mr58107735qko.391.1594223421511; Wed, 08 Jul 2020 08:50:21 -0700 (PDT) Received: from gouda.nowheycreamery.com (c-68-32-74-190.hsd1.mi.comcast.net. [68.32.74.190]) by smtp.gmail.com with ESMTPSA id h41sm26996qtk.68.2020.07.08.08.50.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Jul 2020 08:50:20 -0700 (PDT) From: schumaker.anna@gmail.com X-Google-Original-From: Anna.Schumaker@Netapp.com To: linux-nfs@vger.kernel.org Cc: Anna.Schumaker@Netapp.com Subject: [PATCH v1 1/1] NFS: Fix interrupted slots by sending a solo SEQUENCE operation Date: Wed, 8 Jul 2020 11:50:18 -0400 Message-Id: <20200708155018.110150-2-Anna.Schumaker@Netapp.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200708155018.110150-1-Anna.Schumaker@Netapp.com> References: <20200708155018.110150-1-Anna.Schumaker@Netapp.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-nfs-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org From: Anna Schumaker We used to do this before 3453d5708b33, but this was changed to better handle the NFS4ERR_SEQ_MISORDERED error code. This commit fixed the slot re-use case when the server doesn't receive the interrupted operation, but if the server does receive the operation then it could still end up replying to the client with mis-matched operations from the reply cache. We can fix this by sending a SEQUENCE to the server while recovering from a SEQ_MISORDERED error when we detect that we are in an interrupted slot situation. Fixes: 3453d5708b33 (NFSv4.1: Avoid false retries when RPC calls are interrupted) Signed-off-by: Anna Schumaker --- fs/nfs/nfs4proc.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index e32717fd1169..5de41a5772f0 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -774,6 +774,14 @@ static void nfs4_slot_sequence_acked(struct nfs4_slot *slot, slot->seq_nr_last_acked = seqnr; } +static void nfs4_probe_sequence(struct nfs_client *client, const struct cred *cred, + struct nfs4_slot *slot) +{ + struct rpc_task *task = _nfs41_proc_sequence(client, cred, slot, true); + if (!IS_ERR(task)) + rpc_wait_for_completion_task(task); +} + static int nfs41_sequence_process(struct rpc_task *task, struct nfs4_sequence_res *res) { @@ -790,6 +798,7 @@ static int nfs41_sequence_process(struct rpc_task *task, goto out; session = slot->table->session; + clp = session->clp; trace_nfs4_sequence_done(session, res); @@ -804,7 +813,6 @@ static int nfs41_sequence_process(struct rpc_task *task, nfs4_slot_sequence_acked(slot, slot->seq_nr); /* Update the slot's sequence and clientid lease timer */ slot->seq_done = 1; - clp = session->clp; do_renew_lease(clp, res->sr_timestamp); /* Check sequence flags */ nfs41_handle_sequence_flag_errors(clp, res->sr_status_flags, @@ -852,10 +860,15 @@ static int nfs41_sequence_process(struct rpc_task *task, /* * Were one or more calls using this slot interrupted? * If the server never received the request, then our - * transmitted slot sequence number may be too high. + * transmitted slot sequence number may be too high. However, + * if the server did receive the request then it might + * accidentally give us a reply with a mismatched operation. + * We can sort this out by sending a lone sequence operation + * to the server on the same slot. */ if ((s32)(slot->seq_nr - slot->seq_nr_last_acked) > 1) { slot->seq_nr--; + nfs4_probe_sequence(clp, task->tk_msg.rpc_cred, slot); goto retry_nowait; } /* -- 2.27.0