Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c77365c9 authored by Trond Myklebust's avatar Trond Myklebust
Browse files

NFSv4: Ensure that we don't drop a state owner more than once



Retest the RB_EMPTY_NODE() condition under the spin lock
to ensure that we don't call rb_erase() more than once on the
same state owner.

Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 95b72eb0
Loading
Loading
Loading
Loading
+7 −3
Original line number Original line Diff line number Diff line
@@ -435,13 +435,17 @@ nfs4_alloc_state_owner(struct nfs_server *server,
static void
static void
nfs4_drop_state_owner(struct nfs4_state_owner *sp)
nfs4_drop_state_owner(struct nfs4_state_owner *sp)
{
{
	if (!RB_EMPTY_NODE(&sp->so_server_node)) {
	struct rb_node *rb_node = &sp->so_server_node;

	if (!RB_EMPTY_NODE(rb_node)) {
		struct nfs_server *server = sp->so_server;
		struct nfs_server *server = sp->so_server;
		struct nfs_client *clp = server->nfs_client;
		struct nfs_client *clp = server->nfs_client;


		spin_lock(&clp->cl_lock);
		spin_lock(&clp->cl_lock);
		rb_erase(&sp->so_server_node, &server->state_owners);
		if (!RB_EMPTY_NODE(rb_node)) {
		RB_CLEAR_NODE(&sp->so_server_node);
			rb_erase(rb_node, &server->state_owners);
			RB_CLEAR_NODE(rb_node);
		}
		spin_unlock(&clp->cl_lock);
		spin_unlock(&clp->cl_lock);
	}
	}
}
}