Skip to content

Commit 1ca52fc

Browse files
Ursula Braundavem330
authored andcommitted
net/smc: remove duplicate mutex_unlock
For a failing smc_listen_rdma_finish() smc_listen_decline() is called. If fallback is possible, the new socket is already enqueued to be accepted in smc_listen_decline(). Avoid enqueuing a second time afterwards in this case, otherwise the smc_create_lgr_pending lock is released twice: [ 373.463976] WARNING: bad unlock balance detected! [ 373.463978] 4.18.0-rc7+ #123 Tainted: G O [ 373.463979] ------------------------------------- [ 373.463980] kworker/1:1/30 is trying to release lock (smc_create_lgr_pending) at: [ 373.463990] [<000003ff801205fc>] smc_listen_work+0x22c/0x5d0 [smc] [ 373.463991] but there are no more locks to release! [ 373.463991] other info that might help us debug this: [ 373.463993] 2 locks held by kworker/1:1/30: [ 373.463994] #0: 00000000772cbaed ((wq_completion)"events"){+.+.}, at: process_one_work+0x1ec/0x6b0 [ 373.464000] #1: 000000003ad0894a ((work_completion)(&new_smc->smc_listen_work)){+.+.}, at: process_one_work+0x1ec/0x6b0 [ 373.464003] stack backtrace: [ 373.464005] CPU: 1 PID: 30 Comm: kworker/1:1 Kdump: loaded Tainted: G O 4.18.0-rc7uschi+ #123 [ 373.464007] Hardware name: IBM 2827 H43 738 (LPAR) [ 373.464010] Workqueue: events smc_listen_work [smc] [ 373.464011] Call Trace: [ 373.464015] ([<0000000000114100>] show_stack+0x60/0xd8) [ 373.464019] [<0000000000a8c9bc>] dump_stack+0x9c/0xd8 [ 373.464021] [<00000000001dcaf8>] print_unlock_imbalance_bug+0xf8/0x108 [ 373.464022] [<00000000001e045c>] lock_release+0x114/0x4f8 [ 373.464025] [<0000000000aa87fa>] __mutex_unlock_slowpath+0x4a/0x300 [ 373.464027] [<000003ff801205fc>] smc_listen_work+0x22c/0x5d0 [smc] [ 373.464029] [<0000000000197a68>] process_one_work+0x2a8/0x6b0 [ 373.464030] [<0000000000197ec2>] worker_thread+0x52/0x410 [ 373.464033] [<000000000019fd0e>] kthread+0x15e/0x178 [ 373.464035] [<0000000000aaf58a>] kernel_thread_starter+0x6/0xc [ 373.464052] [<0000000000aaf584>] kernel_thread_starter+0x0/0xc [ 373.464054] INFO: lockdep is turned off. Signed-off-by: Ursula Braun <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 648a5a7 commit 1ca52fc

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

net/smc/af_smc.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1153,9 +1153,9 @@ static int smc_listen_rdma_reg(struct smc_sock *new_smc, int local_contact)
11531153
}
11541154

11551155
/* listen worker: finish RDMA setup */
1156-
static void smc_listen_rdma_finish(struct smc_sock *new_smc,
1157-
struct smc_clc_msg_accept_confirm *cclc,
1158-
int local_contact)
1156+
static int smc_listen_rdma_finish(struct smc_sock *new_smc,
1157+
struct smc_clc_msg_accept_confirm *cclc,
1158+
int local_contact)
11591159
{
11601160
struct smc_link *link = &new_smc->conn.lgr->lnk[SMC_SINGLE_LINK];
11611161
int reason_code = 0;
@@ -1178,11 +1178,12 @@ static void smc_listen_rdma_finish(struct smc_sock *new_smc,
11781178
if (reason_code)
11791179
goto decline;
11801180
}
1181-
return;
1181+
return 0;
11821182

11831183
decline:
11841184
mutex_unlock(&smc_create_lgr_pending);
11851185
smc_listen_decline(new_smc, reason_code, local_contact);
1186+
return reason_code;
11861187
}
11871188

11881189
/* setup for RDMA connection of server */
@@ -1279,8 +1280,10 @@ static void smc_listen_work(struct work_struct *work)
12791280
}
12801281

12811282
/* finish worker */
1282-
if (!ism_supported)
1283-
smc_listen_rdma_finish(new_smc, &cclc, local_contact);
1283+
if (!ism_supported) {
1284+
if (smc_listen_rdma_finish(new_smc, &cclc, local_contact))
1285+
return;
1286+
}
12841287
smc_conn_save_peer_info(new_smc, &cclc);
12851288
mutex_unlock(&smc_create_lgr_pending);
12861289
smc_listen_out_connected(new_smc);

0 commit comments

Comments
 (0)