Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp181943imm; Mon, 1 Oct 2018 08:23:01 -0700 (PDT) X-Google-Smtp-Source: ACcGV60/GFP+/wSHFOg7m7s5RmlQMVWB4koa1GtYI/WkowiIKT91Ob4IOwZltvvQYMQ6KmZneeXB X-Received: by 2002:a17:902:788e:: with SMTP id q14-v6mr12548308pll.49.1538407381031; Mon, 01 Oct 2018 08:23:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538407381; cv=none; d=google.com; s=arc-20160816; b=G4B+etSws6ny5bcUW/aNG/cvFtXEmAuYKHv/yK6dJQbtg0A+qZkmm+F6Gt+tsmgfcg jaiuc567gi+6kRjgwf1UDcBjJUMQt9N17r28gKpuKpz3IFKsjZ5jTpAvcEclWYFi/ABx XgTCaizsMVev72R72wnO5dGFzWLJlptmdG1ou41IfdqgUQkIYO+vL8Jmh/VWPSzHsL0y GZDE0zuFfDXSOJIMFrBgZrqvNnjrDagC7Id5tBk3j9WH+vBSsoJ7kzMzegvBIhZHrZ5x SxSDSjr6IiP4yQK+TUcwyvRFe5gG9Q/+MIizWwRFnOFj2bhAinWNXmqjiGRcC90KU7iz 0zZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:autocrypt :openpgp:from:references:cc:to:subject; bh=hwitz50GMhBXVhaP6XIGwPtVUx748VNY8ntNoaCG9U4=; b=vUjJMOWOBsrlp1fVQDhf7kQHj5Ap15WtlBwBY2kYvFnHITPoTA+OXTF4y2vM7QgQPP PvaBvDXMsncKgwy1h5zz2eDUcpfqXEtu6BQf1BbZ4FRr69/ZEF8hIACBUprmuh9Hxldo x9VsfcAsHlZGvQraUahpBdf1d35rtjgWmPYGooOf9o68g11cAhlj5DSPrjKF/BxFpnVO cf9k71G40QzLQmfqcuj/SAWZlQZAL/8ZNHfpBrKdvOSRB/v7Kh/I7h47vtuxlrQ0aYRX q+gWs+gPpqe86sgSJfypsKJONl/R5IdcxsZfehFbA7KT5R+gip+mau6sIHwQFIS4AKKm +KSg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l185-v6si13355418pfl.134.2018.10.01.08.22.46; Mon, 01 Oct 2018 08:23:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729624AbeJAWAt (ORCPT + 99 others); Mon, 1 Oct 2018 18:00:49 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:47090 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729488AbeJAWAt (ORCPT ); Mon, 1 Oct 2018 18:00:49 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w91FFEXR048501 for ; Mon, 1 Oct 2018 11:22:30 -0400 Received: from e06smtp05.uk.ibm.com (e06smtp05.uk.ibm.com [195.75.94.101]) by mx0a-001b2d01.pphosted.com with ESMTP id 2munkw9s5w-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 01 Oct 2018 11:22:29 -0400 Received: from localhost by e06smtp05.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 1 Oct 2018 16:22:27 +0100 Received: from b06cxnps3075.portsmouth.uk.ibm.com (9.149.109.195) by e06smtp05.uk.ibm.com (192.168.101.135) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 1 Oct 2018 16:22:24 +0100 Received: from d06av21.portsmouth.uk.ibm.com (d06av21.portsmouth.uk.ibm.com [9.149.105.232]) by b06cxnps3075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w91FMN1o65339440 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Mon, 1 Oct 2018 15:22:23 GMT Received: from d06av21.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D459652054; Mon, 1 Oct 2018 18:22:01 +0100 (BST) Received: from oc7163163645.ibm.com (unknown [9.145.1.164]) by d06av21.portsmouth.uk.ibm.com (Postfix) with ESMTP id 6D5E552052; Mon, 1 Oct 2018 18:22:01 +0100 (BST) Subject: Re: [PATCH net 2/5] net/smc: remove duplicate mutex_unlock To: Dan Carpenter , kbuild@01.org Cc: kbuild-all@01.org, davem@davemloft.net, netdev@vger.kernel.org, linux-s390@vger.kernel.org, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, raspl@linux.ibm.com, linux-kernel@vger.kernel.org References: <20180920091243.xgansymg6a4dfixg@mwanda> From: Ursula Braun Openpgp: preference=signencrypt Autocrypt: addr=ubraun@linux.ibm.com; prefer-encrypt=mutual; keydata= xsFNBFfk6uIBEADL7CmNIA6b1fxIX9RZltqQwLRemtjMyS1iSLenbaS0NMF2MLWgSsXyuy0A 0Bz5h+xlOt3SMj7jv8YZmFvSw1EXElJ+RMa/LeiN51zDLICNgcr459odThtqrjEsJdoOVFY1 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bDAUJ EswDAAAKCRDMvao0xe1mRax3D/9Y4D2ANmumdJgvEAPLdEm3kLEL858HVx7GJolVrA9szN3a 82YVrJiaXgSVf3j6hSl1tI2qeSRTLNzgfFJUP7EI8WAMI0HV70Ilh3b6HEq7Mcts9uEFasz1 FidTJ0P4oM8mGVuWk47ozXoqIFtyqDfV9lKRaj8oC8gW9zDcNeQXdJzGbjR8WQa2J4BjN2ir G1uP1uWmXa9BhZYFQizhRkboZvkVHQNw6MxkQPhK1DNdQb+Z2uH8ELD41Kw3nxLnIHb3w7Ff mS8HBL+cu9sNWrW2TXZ1NTJucTg3+2zRHnpGzt11roz5xgEWxPRraZo1SsPOJ5eAxi2u/JNo AFLDNjI9K6N5ZJQfJSlbQ9+6nOzW1th8K2iPcPWuWbplQKeaRo6UQCafCJaj+CxC2iTzmzau Sw+xokHdgtDvSBFHvpJf0atERNKd5bWcJGtpxQxPQlx/XsWm4pB4XXlbk1WjOoFQeRQOyWCv eHRz7wGpY0fe9Q/UWkV40gLoP6d9BD9ZWbGvvT2NZtDCnaHTZ/trtADgxno5TVdr3VzIHah3 mLlLUk+oxMnqJvLTPXppz2/0AsGbEFcLs6fO7P1zr48yAGzNqXlZCiCUZ5DPqvAeOEFHiJUh HjXBWPHQYZeG0DNdRY/dunPOGKIYwUlSY/SaIGvstrmeIGlMBd3TqWZ8qIqvrg== Date: Mon, 1 Oct 2018 17:22:22 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180920091243.xgansymg6a4dfixg@mwanda> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 18100115-0020-0000-0000-000002CDE83F X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18100115-0021-0000-0000-0000211C24C0 Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-10-01_09:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1810010148 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 09/20/2018 11:12 AM, Dan Carpenter wrote: > Hi Ursula, > > I love your patch! Perhaps something to improve: > > [auto build test WARNING on net/master] > > url: https://github.com/0day-ci/linux/commits/Ursula-Braun/net-smc-fixes-2018-09-18/20180919-080857 > > smatch warnings: > net/smc/af_smc.c:1289 smc_listen_work() warn: inconsistent returns 'mutex:&smc_create_lgr_pending'. > Locked on: line 1285 > Unlocked on: line 1209 > > # https://github.com/0day-ci/linux/commit/c69342ef9becfe90f3778db1c386abdd80b786d1 > git remote add linux-review https://github.com/0day-ci/linux > git remote update linux-review > git checkout c69342ef9becfe90f3778db1c386abdd80b786d1 > vim +1289 net/smc/af_smc.c > > 3b2dec260 Hans Wippel 2018-05-18 1231 /* IPSec connections opt out of SMC-R optimizations */ > 3b2dec260 Hans Wippel 2018-05-18 1232 if (using_ipsec(new_smc)) { > 3b2dec260 Hans Wippel 2018-05-18 1233 smc_listen_decline(new_smc, SMC_CLC_DECL_IPSEC, 0); > 3b2dec260 Hans Wippel 2018-05-18 1234 return; > 3b2dec260 Hans Wippel 2018-05-18 1235 } > 3b2dec260 Hans Wippel 2018-05-18 1236 > 3b2dec260 Hans Wippel 2018-05-18 1237 mutex_lock(&smc_create_lgr_pending); > 3b2dec260 Hans Wippel 2018-05-18 1238 smc_close_init(new_smc); > 3b2dec260 Hans Wippel 2018-05-18 1239 smc_rx_init(new_smc); > 3b2dec260 Hans Wippel 2018-05-18 1240 smc_tx_init(new_smc); > 3b2dec260 Hans Wippel 2018-05-18 1241 > 413498440 Hans Wippel 2018-06-28 1242 /* check if ISM is available */ > 413498440 Hans Wippel 2018-06-28 1243 if ((pclc->hdr.path == SMC_TYPE_D || pclc->hdr.path == SMC_TYPE_B) && > 413498440 Hans Wippel 2018-06-28 1244 !smc_check_ism(new_smc, &ismdev) && > 413498440 Hans Wippel 2018-06-28 1245 !smc_listen_ism_init(new_smc, pclc, ismdev, &local_contact)) { > 413498440 Hans Wippel 2018-06-28 1246 ism_supported = true; > 413498440 Hans Wippel 2018-06-28 1247 } > 413498440 Hans Wippel 2018-06-28 1248 > 3b2dec260 Hans Wippel 2018-05-18 1249 /* check if RDMA is available */ > 413498440 Hans Wippel 2018-06-28 1250 if (!ism_supported && > 413498440 Hans Wippel 2018-06-28 1251 ((pclc->hdr.path != SMC_TYPE_R && pclc->hdr.path != SMC_TYPE_B) || > 7005ada68 Ursula Braun 2018-07-25 1252 smc_vlan_by_tcpsk(new_smc->clcsock, &vlan) || > 7005ada68 Ursula Braun 2018-07-25 1253 smc_check_rdma(new_smc, &ibdev, &ibport, vlan, NULL) || > 3b2dec260 Hans Wippel 2018-05-18 1254 smc_listen_rdma_check(new_smc, pclc) || > 3b2dec260 Hans Wippel 2018-05-18 1255 smc_listen_rdma_init(new_smc, pclc, ibdev, ibport, > 3b2dec260 Hans Wippel 2018-05-18 1256 &local_contact) || > 413498440 Hans Wippel 2018-06-28 1257 smc_listen_rdma_reg(new_smc, local_contact))) { > 3b2dec260 Hans Wippel 2018-05-18 1258 /* SMC not supported, decline */ > 145686baa Ursula Braun 2017-10-25 1259 mutex_unlock(&smc_create_lgr_pending); > 603cc1498 Karsten Graul 2018-07-25 1260 smc_listen_decline(new_smc, SMC_CLC_DECL_MODEUNSUPP, > 603cc1498 Karsten Graul 2018-07-25 1261 local_contact); > 3b2dec260 Hans Wippel 2018-05-18 1262 return; > a046d57da Ursula Braun 2017-01-09 1263 } > a046d57da Ursula Braun 2017-01-09 1264 > 3b2dec260 Hans Wippel 2018-05-18 1265 /* send SMC Accept CLC message */ > 3b2dec260 Hans Wippel 2018-05-18 1266 rc = smc_clc_send_accept(new_smc, local_contact); > 3b2dec260 Hans Wippel 2018-05-18 1267 if (rc) { > 145686baa Ursula Braun 2017-10-25 1268 mutex_unlock(&smc_create_lgr_pending); > 3b2dec260 Hans Wippel 2018-05-18 1269 smc_listen_decline(new_smc, rc, local_contact); > 3b2dec260 Hans Wippel 2018-05-18 1270 return; > 3b2dec260 Hans Wippel 2018-05-18 1271 } > 3b2dec260 Hans Wippel 2018-05-18 1272 > 3b2dec260 Hans Wippel 2018-05-18 1273 /* receive SMC Confirm CLC message */ > 3b2dec260 Hans Wippel 2018-05-18 1274 reason_code = smc_clc_wait_msg(new_smc, &cclc, sizeof(cclc), > 3b2dec260 Hans Wippel 2018-05-18 1275 SMC_CLC_CONFIRM); > 3b2dec260 Hans Wippel 2018-05-18 1276 if (reason_code) { > 3b2dec260 Hans Wippel 2018-05-18 1277 mutex_unlock(&smc_create_lgr_pending); > 3b2dec260 Hans Wippel 2018-05-18 1278 smc_listen_decline(new_smc, reason_code, local_contact); > 3b2dec260 Hans Wippel 2018-05-18 1279 return; > 3b2dec260 Hans Wippel 2018-05-18 1280 } > 3b2dec260 Hans Wippel 2018-05-18 1281 > 3b2dec260 Hans Wippel 2018-05-18 1282 /* finish worker */ > c69342ef9 Ursula Braun 2018-09-18 1283 if (!ism_supported) { > c69342ef9 Ursula Braun 2018-09-18 1284 if (smc_listen_rdma_finish(new_smc, &cclc, local_contact)) > c69342ef9 Ursula Braun 2018-09-18 1285 return; > ^^^^^^ > We need to mutex_unlock(&smc_create_lgr_pending); before the return. > The smatch warning is not necessary, since the mutex_unlock(&smc_create_lgr_pending) for this case is done within smc_listen_rdma_finish(). > c69342ef9 Ursula Braun 2018-09-18 1286 } > 3b2dec260 Hans Wippel 2018-05-18 1287 smc_conn_save_peer_info(new_smc, &cclc); > 3b2dec260 Hans Wippel 2018-05-18 1288 mutex_unlock(&smc_create_lgr_pending); > 3b2dec260 Hans Wippel 2018-05-18 @1289 smc_listen_out_connected(new_smc); > a046d57da Ursula Braun 2017-01-09 1290 } > a046d57da Ursula Braun 2017-01-09 1291 > > --- > 0-DAY kernel test infrastructure Open Source Technology Center > https://lists.01.org/pipermail/kbuild-all Intel Corporation > But you could argue the code confuses smatch and other readers. Thus I could improve readability with a patch like this: --- net/smc/af_smc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -1184,7 +1184,6 @@ static int smc_listen_rdma_finish(struct return 0; decline: - mutex_unlock(&smc_create_lgr_pending); smc_listen_decline(new_smc, reason_code, local_contact); return reason_code; } @@ -1284,8 +1283,10 @@ static void smc_listen_work(struct work_ /* finish worker */ if (!ism_supported) { - if (smc_listen_rdma_finish(new_smc, &cclc, local_contact)) + if (smc_listen_rdma_finish(new_smc, &cclc, local_contact)) { + mutex_unlock(&smc_create_lgr_pending); return; + } } smc_conn_save_peer_info(new_smc, &cclc); mutex_unlock(&smc_create_lgr_pending); ---