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

Commit bc7581e3 authored by Alexander Aring's avatar Alexander Aring Committed by Greg Kroah-Hartman
Browse files

dlm: fix pending remove if msg allocation fails



[ Upstream commit ba58995909b5098ca4003af65b0ccd5a8d13dd25 ]

This patch unsets ls_remove_len and ls_remove_name if a message
allocation of a remove messages fails. In this case we never send a
remove message out but set the per ls ls_remove_len ls_remove_name
variable for a pending remove. Unset those variable should indicate
possible waiters in wait_pending_remove() that no pending remove is
going on at this moment.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarAlexander Aring <aahringo@redhat.com>
Signed-off-by: default avatarDavid Teigland <teigland@redhat.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 4f1d21c7
Loading
Loading
Loading
Loading
+2 −1
Original line number Original line Diff line number Diff line
@@ -4067,13 +4067,14 @@ static void send_repeat_remove(struct dlm_ls *ls, char *ms_name, int len)
	rv = _create_message(ls, sizeof(struct dlm_message) + len,
	rv = _create_message(ls, sizeof(struct dlm_message) + len,
			     dir_nodeid, DLM_MSG_REMOVE, &ms, &mh);
			     dir_nodeid, DLM_MSG_REMOVE, &ms, &mh);
	if (rv)
	if (rv)
		return;
		goto out;


	memcpy(ms->m_extra, name, len);
	memcpy(ms->m_extra, name, len);
	ms->m_hash = hash;
	ms->m_hash = hash;


	send_message(mh, ms);
	send_message(mh, ms);


out:
	spin_lock(&ls->ls_remove_spin);
	spin_lock(&ls->ls_remove_spin);
	ls->ls_remove_len = 0;
	ls->ls_remove_len = 0;
	memset(ls->ls_remove_name, 0, DLM_RESNAME_MAXLEN);
	memset(ls->ls_remove_name, 0, DLM_RESNAME_MAXLEN);