Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp5291044ybe; Tue, 10 Sep 2019 01:09:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqyYMxEkvBGZlpk5HFxH4K4z3i3v9FYJAQrFkh7mD2CU028CTMo+7lw+BseBbQVH2eJD3Sf6 X-Received: by 2002:a17:906:6bc8:: with SMTP id t8mr23941462ejs.188.1568102998216; Tue, 10 Sep 2019 01:09:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568102998; cv=none; d=google.com; s=arc-20160816; b=tTut3G3XsqBRe10WWGthnbf7wmxjTnDhKi4Tg4o4l3iEdt30HfiEpW0lAFAd6E5JVj mSpT1iiq6Hz44T0cQvP2513cMo7tca/dAHDejy69ito11++LRm7ESGjIbceuKAXpREEE EGi9Bd3NHpB47DbWzwXrVZzLJzVo2SwbsYgpKxHNFT4uQ0FM8R3nmWT4DHFpkzJOGJx5 RK8CTQlDsQBK0QBFa8OE4oSZKx0zw0Rpe6iivCr8OfJNOh0gi5MI2M+uhPuSjnEM+jgi 7RBpQQk3Pz0op/eueG6yjGd23rr6rO6op287cwOw3HJTnpeDiAIZoqECq3VLiB0A48ae 0q7A== 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=owbPNNcxjT5XKu6v3G4mEstWx8051g6tPkh8ytztNTM=; b=0WGpD9FrhmfpADLA/Paj2Frvvm8val1w4M2DSs+P8hK3KAPQfPZa5UhVybwwdJjFEi mefKBu1sswd/HYw5pp4AugajBolU68PhO/hIrgwawd9jHQIfrv2BOS3wFjOi63HjMk3H NvC85iTKRj3ldur0SAtjilpH9Vd/3wSDxs2EVvdhiqC+jPaxTsVrb5onXeiRaW6g5hlw Jb6Y2/ij4fzSc7Dwa17eyUD7oRtBFOjDTaPstHqNkbxopZW5EzTtD2XHyBjA7IaW3kdS n4dJ0clFwAiQPT+VQQKHyj0db9d7IPymheQbgZXdqVYAqbXvXIM8jIyQB3t58WswfiFa GwcA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ia67wefX; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n22si4278237edq.33.2019.09.10.01.09.34; Tue, 10 Sep 2019 01:09:58 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-nfs-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=@gmail.com header.s=20161025 header.b=ia67wefX; spf=pass (google.com: best guess record for domain of linux-nfs-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405066AbfIIODS (ORCPT + 99 others); Mon, 9 Sep 2019 10:03:18 -0400 Received: from mail-io1-f67.google.com ([209.85.166.67]:35012 "EHLO mail-io1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405119AbfIIODS (ORCPT ); Mon, 9 Sep 2019 10:03:18 -0400 Received: by mail-io1-f67.google.com with SMTP id f4so28185074ion.2 for ; Mon, 09 Sep 2019 07:03:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=owbPNNcxjT5XKu6v3G4mEstWx8051g6tPkh8ytztNTM=; b=ia67wefXuFxZMgxGJMvrs1gqh8QiaCeHbp2Cvfxt+89TJyUrmNgJqGeohFnCxx5zGG HyIZZI0svLnBGlnZHJxHFFw56qka1Sbsnf6YIsbZX5ZSMjpsUJ/kUGFNYJS56Trw24qr GaLwep7yVriBxxDpFab0LMuUGF/j476Lb0SSzwos5yLjWk4wveJsno1yyFGG7QTxH/t0 y4eUlWekYJ4XozUK1EiOZ1nW+fxJxBLRPO8g6m7QU82UoYs7s2zxaD4GFo7ucaEDnIkC wC5c0qJdFWQAE6/Vu0Qchn1d94hFwugnabwDAtT44joqMOtIgBoGuVRS/Rjjx8oz9LdC ZCXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=owbPNNcxjT5XKu6v3G4mEstWx8051g6tPkh8ytztNTM=; b=alLsCYVTzrOTjg/NjIvjHj8UWH5uoANfJuuWSVDKEZpW0w0yvD61574giOHoDg8hOV rRU70fjKERW0iBL/oFzEFE+5rlnmKzTGFkp8of5AhQV3JWZ3pedfV8D+9Xckpd2hissB DFRcJY8Lx/yucjGEkn/9xyxbk5HNTV9oxL1Gi72WCtgHki0Q/syOpElbeOTOOatzWDBN NQUVogdALKkn8seudNoVAyEcKoZf3D0vOSSBCM6/EZXegHsw4ii2GpsKhYCv2mAXyxYA YxmENYBjI14RfbtgRNSn8gzGkP2ozXhblaSKFQEZ0J/Ys/ccSyaWVF9QGNZ1jFIgolxZ hvkA== X-Gm-Message-State: APjAAAU68kS7LDh6IlFe/dKwWj5JOoybvq1MoimeNQsX+pbCeDZ6cEa7 M+lmLYD0Mk0ruFaTj1cRLOfUW9CeMw== X-Received: by 2002:a05:6638:681:: with SMTP id i1mr25367999jab.127.1568037796898; Mon, 09 Sep 2019 07:03:16 -0700 (PDT) Received: from localhost.localdomain (50-36-167-63.alma.mi.frontiernet.net. [50.36.167.63]) by smtp.gmail.com with ESMTPSA id h70sm33727176iof.48.2019.09.09.07.03.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2019 07:03:16 -0700 (PDT) From: Trond Myklebust X-Google-Original-From: Trond Myklebust To: Anna Schumaker Cc: linux-nfs@vger.kernel.org Subject: [PATCH 5/9] NFSv4: Add a helper to increment stateid seqids Date: Mon, 9 Sep 2019 10:01:00 -0400 Message-Id: <20190909140104.78818-5-trond.myklebust@hammerspace.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190909140104.78818-4-trond.myklebust@hammerspace.com> References: <20190909140104.78818-1-trond.myklebust@hammerspace.com> <20190909140104.78818-2-trond.myklebust@hammerspace.com> <20190909140104.78818-3-trond.myklebust@hammerspace.com> <20190909140104.78818-4-trond.myklebust@hammerspace.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 Add a helper function to increment stateid seqids according to the rules specified in RFC5661 Section 8.2.2. Signed-off-by: Trond Myklebust --- fs/nfs/nfs4_fs.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h index 3564da1ba8a1..e8f74ed98e42 100644 --- a/fs/nfs/nfs4_fs.h +++ b/fs/nfs/nfs4_fs.h @@ -574,6 +574,15 @@ static inline bool nfs4_stateid_is_newer(const nfs4_stateid *s1, const nfs4_stat return (s32)(be32_to_cpu(s1->seqid) - be32_to_cpu(s2->seqid)) > 0; } +static inline void nfs4_stateid_seqid_inc(nfs4_stateid *s1) +{ + u32 seqid = be32_to_cpu(s1->seqid); + + if (++seqid == 0) + ++seqid; + s1->seqid = cpu_to_be32(seqid); +} + static inline bool nfs4_valid_open_stateid(const struct nfs4_state *state) { return test_bit(NFS_STATE_RECOVERY_FAILED, &state->flags) == 0; -- 2.21.0