Skip to content

Commit d09a040

Browse files
metze-sambasmfrench
authored andcommitted
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: Stefan Metzmacher <metze@samba.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 25c2e34 commit d09a040

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

fs/smb/common/smbdirect/smbdirect_mr.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,7 @@ void smbdirect_connection_deregister_mr_io(struct smbdirect_mr_io *mr)
410410
struct smbdirect_socket *sc = mr->socket;
411411
int ret = 0;
412412

413+
lock_again:
413414
mutex_lock(&mr->mutex);
414415
if (mr->state == SMBDIRECT_MR_DISABLED)
415416
goto put_kref;
@@ -440,8 +441,15 @@ void smbdirect_connection_deregister_mr_io(struct smbdirect_mr_io *mr)
440441
smbdirect_socket_schedule_cleanup(sc, ret);
441442
goto done;
442443
}
444+
445+
/*
446+
* We still hold the reference to mr
447+
* so we can unlock while waiting.
448+
*/
449+
mutex_unlock(&mr->mutex);
443450
wait_for_completion(&mr->invalidate_done);
444451
mr->need_invalidate = false;
452+
goto lock_again;
445453
} else
446454
/*
447455
* For remote invalidation, just set it to SMBDIRECT_MR_INVALIDATED

0 commit comments

Comments
 (0)