Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp3231967pxb; Tue, 13 Apr 2021 23:49:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxs2m9raxFwb7VXzaONjTgGwmkXaPwEarXaF+HFfoCkXPAl3U59y2xY3P6pgFYX8eB8wjLF X-Received: by 2002:a17:906:6dc9:: with SMTP id j9mr37081660ejt.188.1618382967237; Tue, 13 Apr 2021 23:49:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618382967; cv=none; d=google.com; s=arc-20160816; b=dgcpAF8iwPiGYgiCKFIxuR1wZJYjAWOSdVjeuQoieRvj6hrI/QMn/QW078ZHvnUjwJ /9tdgK9VBA/Ulv15oBk9Todas8PAHZiGOdhtrYrEUtEyBso2rMDhCKmtwWfT7gB3qeYl buJIP3O/rmNOwbXf4Da5b8JMYYtSB8IzCTH6xh55iCyfZysQoQCt1UMywcV4hBOjg7Fh 4jm6EjVt8JZ5R0dg+awGE4W4k0+A/VT2xcr2+AfElJJaR472ostB7gPAECiJzzVlgrmw el0DolfSc3YMW1CO0CRBWtj5TzSm3VezEZa8zW0myn03JZ0XLWVK8dw7mVgFm8Q/1ZYF rQcw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=TPU2CfqjCeWWuPm92kUe/3s1c7eIrvRyHZCn4b8ad8I=; b=vGnclcLNZFXNVmfUJN/bGa6EmNLDQR3JF8DKRVxhZrjuN/0u9ZTUIk4sbbC4H5MAqn JnykcCdyoWCf8hWKf1oRcP5pa1qYdoLqCVWckPejYWsfK473FmdNz0rM5HJzZnngmvKs qv/xnHA8yOEl7+psF0GSSbvIjMEZdhMEyzd1rlwnofv16l7Bx6WGdTnR3qZdNI5xZBLt NVo69jpXeDR8S3l5NUxC7mcjscVgsI571euRX4UcFenunpTj1aHR2IqUENP6e3gaS+AX XWwcWDxtd4yvG9P6HND+4KuVxuYj5mEJy4L0HWNUAnjhvlPAxeuh/mIC3ZpP0mWrqKv6 Dejg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@umich.edu header.s=google-2016-06-03 header.b=aE69idjA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=umich.edu Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gy3si11902374ejb.557.2021.04.13.23.48.53; Tue, 13 Apr 2021 23:49:27 -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=pass header.i=@umich.edu header.s=google-2016-06-03 header.b=aE69idjA; 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=pass (p=NONE sp=NONE dis=NONE) header.from=umich.edu Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240342AbhDMUww (ORCPT + 99 others); Tue, 13 Apr 2021 16:52:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58142 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231435AbhDMUwu (ORCPT ); Tue, 13 Apr 2021 16:52:50 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88247C061574 for ; Tue, 13 Apr 2021 13:52:27 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id u21so28066093ejo.13 for ; Tue, 13 Apr 2021 13:52:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=umich.edu; s=google-2016-06-03; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=TPU2CfqjCeWWuPm92kUe/3s1c7eIrvRyHZCn4b8ad8I=; b=aE69idjAUrI0j5DeegUzJyv52Wy94GD4kZ6biBTKPYl1H7+ghaN4AYXoq6ma7EDAKq aYjOCw2YT3y7QS9WSdbiwqxk6Vl+aVFaZ8k5pHnpwzQbBoqLzT5CN9uBrGdOFA56Qrpd fSBalLJq/xKgU6wPVlrTrXOA46JfF0NIDJQeLngdN5L9RsoNysTK/079Y23R0Q9OJM34 FOsH7z+2Xjl2XHHRXieY75CpeV5V7sIYoc6+cMjLL43Y9X4w0Kp9OOmRU6u5VjHa1WH7 ztIPEvpi6gcHaYb8Dxcg1nIgOLW4sbLUndRuftGLbAwEs/ePP5/XR7mteWoG0wfnyO1y lkZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=TPU2CfqjCeWWuPm92kUe/3s1c7eIrvRyHZCn4b8ad8I=; b=VB2xafYgBs/f/t6KesXpdeQ7AcB6OaqHwuDBrfcvBT4Xx2ZQAgYvu5bgDq5RX/v+LS UdoZK/Q75GWoDJ04b9EmE01uyiQF2Pq7cm6eO5Qqi/kvWfqMLfe/U7+lB3R9s9Pn8/wq b9g1B0Oy3ibMMLX6jD4OCQtR9IjyhQnjKzoEHZyn0Atvi5EHlj6GpVZSZ2ob6rlg1CiO xGaUIeqQvzGPIxRSy11R92tqldsnmHCFCcLhD8VzbTaUf0qVPf43XMpnni1SC/Z0D69g 6x1Hgf8keWC0+iY3LDXIspGxbQ17SB8PtPCuV2cjwyfD0UFGS1yGzcP4SnsCYojpB7Nk /lAQ== X-Gm-Message-State: AOAM531Ooyy24RHWsTGF9Di+7PS9Ps6WoiI4DSWFn+Uu8Q9P38nX5p+n DGhYyiADmKOOKSWZLE2c0eu3QYIKkU1DsjYZg+kzr+8C X-Received: by 2002:a17:907:62a7:: with SMTP id nd39mr34593523ejc.510.1618347146195; Tue, 13 Apr 2021 13:52:26 -0700 (PDT) MIME-Version: 1.0 References: <20210413171738.GA28230@fieldses.org> <20210413192908.GD28230@fieldses.org> In-Reply-To: <20210413192908.GD28230@fieldses.org> From: Olga Kornievskaia Date: Tue, 13 Apr 2021 16:52:14 -0400 Message-ID: Subject: Re: Linux NFSv4.1 client session seqid sometimes advances by 2 To: "J. Bruce Fields" Cc: Rick Macklem , Linux-NFS Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org On Tue, Apr 13, 2021 at 3:29 PM J. Bruce Fields wrote: > > On Tue, Apr 13, 2021 at 02:59:27PM -0400, Olga Kornievskaia wrote: > > On Tue, Apr 13, 2021 at 1:17 PM J. Bruce Fields wrote: > > > > > > On Tue, Apr 13, 2021 at 09:31:37AM -0400, Olga Kornievskaia wrote: > > > > On Tue, Apr 13, 2021 at 3:08 AM Rick Macklem wrote: > > > > > > > > > > Hi, > > > > > > > > > > During testing of a Fedora Core 30 (5.2.10 kernel) against a FreeBSD > > > > > server (4.1 mount), I have been simulating a network partitioning > > > > > for a few minutes (until the TCP connection goes to SYN_SENT on > > > > > the Linux client). > > > > > > > > > > Sometimes, after the network partition heals, the FreeBSD server > > > > > replies NFS4ERR_SEQ_MISORDERED. > > > > > Looking at the packet trace, the seqid for the slot has advanced by > > > > > 2 instead of 1. An RPC request for old-seqid + 1 never seems to get > > > > > sent. > > > > > --> Since sending an RPC with "seqid + 2" but never sending one > > > > > that is "seqid + 1" for a slot seems harmless, I have added an optional > > > > > hack (can be turned off), to allow this case instead of replying > > > > > NFS4ERR_SEQ_MISORDERED for it. The code will still reply > > > > > NFS4ERR_SEQ_MISORDERED if an RPC for the slot with > > > > > "old seqid + 1" in it. > > > > > --> Yes, doing this hack is a violation of RFC5661, but I've > > > > > done it anyhow. > > > > > > > > > > If you are interested in a packet capture with this in it: > > > > > fetch https://people.freebsd.org/~rmacklem/linuxtofreenfs.pcap > > > > > - then look at packet #1945 and #2072 > > > > > --> You'll see that slot #1 seqid goes from 4 to 6. There is no > > > > > slot#1 seqid 5 RPC sent on the wire. > > > > > (This packet capture was taken on the Linux client using > > > > > tcpdump.) > > > > > --> Btw, the "RST battle" you'll see in the above trace between > > > > > #2005 and #2068 that goes on until the FreeBSD > > > > > krpc/NFS times out the connection after 6min. seems to be a recent > > > > > FreeBSD TCP bug. > > > > > I have reproduced this seqid advances by 2 on an older system > > > > > that does not "RST battle" and allows the reconnect right away, > > > > > once the network partition is healed, so it does seem to be > > > > > relevant to this bug. > > > > > > > > > > Someday, I will get around to upgrading to a more recent Linux > > > > > kernel and will test to see if I can still reproduce this bug. > > > > > On 5.2.10, it is intermittent and does not occur every time I > > > > > do the network partitioning test. > > > > > > > > > > Mostly just fyi, rick > > > > > > > > Hi Rick, > > > > > > > > I think this is happening because slotid=1 had something queued up > > > > using seqid=5 and that was interrupted because the connection was > > > > RSTed. For the interrupted slot, the client would send solo SEQUENCE > > > > with +1 seqid. > > > > > > Doesn't the client send the solo SEQUENCE with seqid 5 in that case? > > > > No it sends with seq+1 because NFS layer client doesn't know if seqid > > actually was actually transmitted before the connection got caught > > (and/or received by the server). > > But then the MISORDERED tells the client it wasn't received, so the > client follows up with a call with seqid 5--is that what happens? Correct. If there were no error then the server did indeed consume seqid. And if an error was returned then the client knows to decrement. > Sorry, I seem to recall we went through this all a couple years ago, but > now I've forgotten how it works. > > --b.