All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] NFSv4.0: Fix the wake up of the next waiter in nfs_release_seqid()
@ 2024-11-08 22:13 trondmy
  2024-11-08 22:13 ` [PATCH 2/2] NFSv4.0: Fix a use-after-free problem in the asynchronous open() trondmy
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: trondmy @ 2024-11-08 22:13 UTC (permalink / raw)
  To: Yang Erkun; +Cc: linux-nfs

From: Trond Myklebust <trond.myklebust@hammerspace.com>

There is no need to wake up another waiter on the seqid list unless the
seqid being removed is at the head of the list, and so is relinquishing
control of the sequence counter to the next entry.

Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
---
 fs/nfs/nfs4state.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
index dafd61186557..9a9f60a2291b 100644
--- a/fs/nfs/nfs4state.c
+++ b/fs/nfs/nfs4state.c
@@ -1083,14 +1083,12 @@ void nfs_release_seqid(struct nfs_seqid *seqid)
 		return;
 	sequence = seqid->sequence;
 	spin_lock(&sequence->lock);
-	list_del_init(&seqid->list);
-	if (!list_empty(&sequence->list)) {
-		struct nfs_seqid *next;
-
-		next = list_first_entry(&sequence->list,
-				struct nfs_seqid, list);
+	if (list_is_first(&seqid->list, &sequence->list) &&
+	    !list_is_singular(&sequence->list)) {
+		struct nfs_seqid *next = list_next_entry(seqid, list);
 		rpc_wake_up_queued_task(&sequence->wait, next->task);
 	}
+	list_del_init(&seqid->list);
 	spin_unlock(&sequence->lock);
 }
 
-- 
2.47.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-12-26  1:22 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-08 22:13 [PATCH 1/2] NFSv4.0: Fix the wake up of the next waiter in nfs_release_seqid() trondmy
2024-11-08 22:13 ` [PATCH 2/2] NFSv4.0: Fix a use-after-free problem in the asynchronous open() trondmy
2024-11-09  2:25   ` yangerkun
2024-12-26  1:21   ` Sasha Levin
2024-11-09  2:24 ` [PATCH 1/2] NFSv4.0: Fix the wake up of the next waiter in nfs_release_seqid() yangerkun
2024-12-25  2:50 ` Li Lingfeng
2024-12-25  3:21   ` yangerkun
2024-12-26  1:21 ` Sasha Levin

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.