All of lore.kernel.org
 help / color / mirror / Atom feed
From: Trond Myklebust <trondmy@gmail.com>
To: linux-nfs@vger.kernel.org
Subject: [PATCH 10/14] NFSv4: Update the stateid seqid in nfs_revoke_delegation()
Date: Wed, 23 Oct 2019 19:55:56 -0400	[thread overview]
Message-ID: <20191023235600.10880-11-trond.myklebust@hammerspace.com> (raw)
In-Reply-To: <20191023235600.10880-10-trond.myklebust@hammerspace.com>

If we revoke a delegation, but the stateid's seqid is newer, then
ensure we update the seqid when marking the delegation as revoked.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/delegation.c | 15 +++++++++++++--
 1 file changed, 13 insertions(+), 2 deletions(-)

diff --git a/fs/nfs/delegation.c b/fs/nfs/delegation.c
index b6cc2e71fcdb..5a87d32a8d7c 100644
--- a/fs/nfs/delegation.c
+++ b/fs/nfs/delegation.c
@@ -760,8 +760,19 @@ static bool nfs_revoke_delegation(struct inode *inode,
 	if (stateid == NULL) {
 		nfs4_stateid_copy(&tmp, &delegation->stateid);
 		stateid = &tmp;
-	} else if (!nfs4_stateid_match(stateid, &delegation->stateid))
-		goto out;
+	} else {
+		if (!nfs4_stateid_match_other(stateid, &delegation->stateid))
+			goto out;
+		spin_lock(&delegation->lock);
+		if (stateid->seqid) {
+			if (nfs4_stateid_is_newer(&delegation->stateid, stateid)) {
+				spin_unlock(&delegation->lock);
+				goto out;
+			}
+			delegation->stateid.seqid = stateid->seqid;
+		}
+		spin_unlock(&delegation->lock);
+	}
 	nfs_mark_delegation_revoked(NFS_SERVER(inode), delegation);
 	ret = true;
 out:
-- 
2.21.0


  reply	other threads:[~2019-10-23 23:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-23 23:55 [PATCH 00/14] Delegation bugfixes Trond Myklebust
2019-10-23 23:55 ` [PATCH 01/14] NFSv4: Don't allow a cached open with a revoked delegation Trond Myklebust
2019-10-23 23:55   ` [PATCH 02/14] NFSv4: Fix delegation handling in update_open_stateid() Trond Myklebust
2019-10-23 23:55     ` [PATCH 03/14] NFSv4: nfs4_callback_getattr() should ignore revoked delegations Trond Myklebust
2019-10-23 23:55       ` [PATCH 04/14] NFSv4: Delegation recalls should not find " Trond Myklebust
2019-10-23 23:55         ` [PATCH 05/14] NFSv4: fail nfs4_refresh_delegation_stateid() when the delegation was revoked Trond Myklebust
2019-10-23 23:55           ` [PATCH 06/14] NFS: Rename nfs_inode_return_delegation_noreclaim() Trond Myklebust
2019-10-23 23:55             ` [PATCH 07/14] NFSv4: Don't remove the delegation from the super_list more than once Trond Myklebust
2019-10-23 23:55               ` [PATCH 08/14] NFSv4: Hold the delegation spinlock when updating the seqid Trond Myklebust
2019-10-23 23:55                 ` [PATCH 09/14] NFSv4: Clear the NFS_DELEGATION_REVOKED flag in nfs_update_inplace_delegation() Trond Myklebust
2019-10-23 23:55                   ` Trond Myklebust [this message]
2019-10-23 23:55                     ` [PATCH 11/14] NFSv4: Revoke the delegation on success in nfs4_delegreturn_done() Trond Myklebust
2019-10-23 23:55                       ` [PATCH 12/14] NFSv4: Ignore requests to return the delegation if it was revoked Trond Myklebust
2019-10-23 23:55                         ` [PATCH 13/14] NFSv4: Don't reclaim delegations that have been returned or revoked Trond Myklebust
2019-10-23 23:56                           ` [PATCH 14/14] NFSv4: Fix races between open and delegreturn Trond Myklebust
2019-10-31 15:27 ` [PATCH 00/14] Delegation bugfixes Olga Kornievskaia
2019-10-31 15:49   ` Olga Kornievskaia
2019-10-31 16:15     ` Olga Kornievskaia
2019-10-31 22:54       ` Trond Myklebust

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191023235600.10880-11-trond.myklebust@hammerspace.com \
    --to=trondmy@gmail.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.