Skip to content

Commit a8e128b

Browse files
metze-sambasmfrench
authored andcommitted
smb: client: let destroy_mr_list() remove locked from the list
This should make sure get_mr() can't see the removed entries. 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: 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 19421ec commit a8e128b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

fs/smb/client/smbdirect.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2355,9 +2355,16 @@ static void smbd_mr_recovery_work(struct work_struct *work)
23552355
static void destroy_mr_list(struct smbdirect_socket *sc)
23562356
{
23572357
struct smbdirect_mr_io *mr, *tmp;
2358+
LIST_HEAD(all_list);
2359+
unsigned long flags;
23582360

23592361
disable_work_sync(&sc->mr_io.recovery_work);
2360-
list_for_each_entry_safe(mr, tmp, &sc->mr_io.all.list, list) {
2362+
2363+
spin_lock_irqsave(&sc->mr_io.all.lock, flags);
2364+
list_splice_tail_init(&sc->mr_io.all.list, &all_list);
2365+
spin_unlock_irqrestore(&sc->mr_io.all.lock, flags);
2366+
2367+
list_for_each_entry_safe(mr, tmp, &all_list, list) {
23612368
if (mr->state == SMBDIRECT_MR_INVALIDATED)
23622369
ib_dma_unmap_sg(sc->ib.dev, mr->sgt.sgl,
23632370
mr->sgt.nents, mr->dir);

0 commit comments

Comments
 (0)