]> git.dujemihanovic.xyz Git - linux.git/commit
nfsd: avoid races with wake_up_var()
authorNeilBrown <neilb@suse.de>
Fri, 30 Aug 2024 07:03:17 +0000 (17:03 +1000)
committerChuck Lever <chuck.lever@oracle.com>
Fri, 20 Sep 2024 23:31:03 +0000 (19:31 -0400)
commit15392c8cd13449bf0c09faf8e78ca2fdfb023284
treec2fc3be707862bd648d5456c3eafecfb8adb5305
parent985eeae9c874157bb8ece9060020856f68aa08d5
nfsd: avoid races with wake_up_var()

wake_up_var() needs a barrier after the important change is made in the
var and before wake_up_var() is called, else it is possible that a wake
up won't be sent when it should.

In each case here the var is changed in an "atomic" manner, so
smb_mb__after_atomic() is sufficient.

In one case the important change (removing the lease) is performed
*after* the wake_up, which is backwards.  The code survives in part
because the wait_var_event is given a timeout.

This patch adds the required barriers and calls destroy_delegation()
*before* waking any threads waiting for the delegation to be destroyed.

Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4state.c