Commit d09a040c authored by Stefan Metzmacher's avatar Stefan Metzmacher Committed by Steve French
Browse files

smb: smbdirect: let smbdirect_connection_deregister_mr_io unlock while waiting



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: default avatarStefan Metzmacher <metze@samba.org>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent 25c2e349
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -410,6 +410,7 @@ void smbdirect_connection_deregister_mr_io(struct smbdirect_mr_io *mr)
	struct smbdirect_socket *sc = mr->socket;
	int ret = 0;

lock_again:
	mutex_lock(&mr->mutex);
	if (mr->state == SMBDIRECT_MR_DISABLED)
		goto put_kref;
@@ -440,8 +441,15 @@ void smbdirect_connection_deregister_mr_io(struct smbdirect_mr_io *mr)
			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