We should not hold a mutex locked during wait_for_completion()
holding a reference is enough.
Cc: Steve French <smfrench@gmail.com>
Cc: Tom Talpey <tom@talpey.com>
Cc: Long Li <longli@microsoft.com>
Cc: Namjae Jeon <linkinjeon@kernel.org>
Cc: David Howells <dhowells@redhat.com>
Cc: Henrique Carvalho <henrique.carvalho@suse.com>
Cc: linux-cifs@vger.kernel.org
Cc: samba-technical@lists.samba.org
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
struct smbdirect_socket *sc = mr->socket;
int ret = 0;
+lock_again:
mutex_lock(&mr->mutex);
if (mr->state == SMBDIRECT_MR_DISABLED)
goto put_kref;
smbdirect_socket_schedule_cleanup(sc, ret);
goto done;
}
+
+ /*
+ * We still hold the reference to mr
+ * so we can unlock while waiting.
+ */
+ mutex_unlock(&mr->mutex);
wait_for_completion(&mr->invalidate_done);
mr->need_invalidate = false;
+ goto lock_again;
} else
/*
* For remote invalidation, just set it to SMBDIRECT_MR_INVALIDATED