From patchwork Fri Jul 7 10:43:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Niklas Schnelle X-Patchwork-Id: 117088 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp3180897vqx; Fri, 7 Jul 2023 04:04:38 -0700 (PDT) X-Google-Smtp-Source: APBJJlETelWLd0sOfJr5SUqAHwT2MZ8AAXumyzbx3gx+a8V8YRNQxJxMxbmg63p4BDcR0sMvap+v X-Received: by 2002:a05:6a20:54a6:b0:12d:346f:d8ac with SMTP id i38-20020a056a2054a600b0012d346fd8acmr5051823pzk.44.1688727878490; Fri, 07 Jul 2023 04:04:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688727878; cv=none; d=google.com; s=arc-20160816; b=OaC9brpxo0Bai/YubNewOYxbrOV5lU+ZGA3UKXzxjx4LEl/yjRdrYfVfBUnBtskWUB 3qASn3yogNBPzm6gsLIrPUIu+wzSGe5Of+x2rb9+ngaM4iS1ghMZC8z0yRar3wnqQmdP qgGbfAmVyrtY4af0nZ6TnEz+y1wQ5nVdEefGldZMXOmKOwi4XXupWk+ggsscXl6J6rbG GHyV+nqraN36+TRHTjefB59PTB/z6bfKBncdN4KFd3RasFEruN4MAkwZ+FTNHiJy8Ad9 oKKbSFWloF9SBcgg7YeMPFUidyuMfYGObBzU9i/c3ZwQKABLP2hbeRzKzQq8oRJ0hJWv 6o8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=jXhueTSPOHMzlueqvymp8seQ1H++N+GTe725CM9biwY=; fh=9Lbv+Hu93eUfjflUziLmPYNiqIdzzgdXrsBN80HI240=; b=Vfq8vMmztSia1VTqOC4zeVUYX7RZwXhQuFxKaJ3Qtq+7JyiW6ujJcaTZLf5k9OttiQ yymdnWuIHU5XYtbgEpO2BF7+pgJrkVKLyPQLFFxWAfPU9qVGm3Vp4x+I3jmuG9ieTdoF sLaK2hWLVn5ie7H4TYhfWFtC94VNLEaj5wpHPPKq3l9KRtYgWhPQ6lFME3bwPoM/g7DX GpmmCEWdWOqzxxbwJ8Pyjti4n7ktukdBlKpNWHaod6cYIkgQ+PUMehM6ZAOsH/5vc6wN W1EmQnFBcHpDmbD0+HF57dze0IPfKVfsp+bx+DtouVxDlGGcwsWwefJb23Ztw6wmEbaB ULdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=MX+D2ct1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i4-20020a63e444000000b0055bf3d0c98bsi3091222pgk.740.2023.07.07.04.04.22; Fri, 07 Jul 2023 04:04:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@ibm.com header.s=pp1 header.b=MX+D2ct1; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232713AbjGGKoR (ORCPT + 99 others); Fri, 7 Jul 2023 06:44:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48764 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232647AbjGGKoN (ORCPT ); Fri, 7 Jul 2023 06:44:13 -0400 Received: from mx0b-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B84831737; Fri, 7 Jul 2023 03:44:11 -0700 (PDT) Received: from pps.filterd (m0353723.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 367AJ2Eq022909; Fri, 7 Jul 2023 10:44:10 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=jXhueTSPOHMzlueqvymp8seQ1H++N+GTe725CM9biwY=; b=MX+D2ct1BfD0A5mbo6FU8r5n70vr6NWZqiPWu/qWK6PvN7N8UNx22jlyTGQFW+EgWDO6 Ua6oTAs8FF1qIzFvffBegHqr9RvftKUXXTryJ+rZSI/ErQElzbyFO5/65XqRejx6gVhX GeXweDSgkp+NQSl2W5u/ieXme4ZGSGa48gi1jx81XU0ZMw/pNuvXKPA86rCufSCI7AMS WJSkV+glBA2D3uVgD6zZ50PfBeDL9PS98y3AopZv5TQkOflfF5FDfECFjUed89ASonG+ ONQX5GispEPKFGF18cDlkyLGaoR8OzEx3loC8rd+BrzoeV6QMbieNfpSB5pAGNYsCQ5P BA== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rpgun8m4r-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Jul 2023 10:44:09 +0000 Received: from m0353723.ppops.net (m0353723.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 367AN2NV003223; Fri, 7 Jul 2023 10:44:09 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3rpgun8m3u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Jul 2023 10:44:09 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3673dexW014309; Fri, 7 Jul 2023 10:44:06 GMT Received: from smtprelay01.fra02v.mail.ibm.com ([9.218.2.227]) by ppma06fra.de.ibm.com (PPS) with ESMTPS id 3rjbddtw1b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 07 Jul 2023 10:44:06 +0000 Received: from smtpav02.fra02v.mail.ibm.com (smtpav02.fra02v.mail.ibm.com [10.20.54.101]) by smtprelay01.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 367Ai2HS19726956 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 7 Jul 2023 10:44:03 GMT Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DCEDE2006C; Fri, 7 Jul 2023 10:44:02 +0000 (GMT) Received: from smtpav02.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 616AE20067; Fri, 7 Jul 2023 10:44:02 +0000 (GMT) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by smtpav02.fra02v.mail.ibm.com (Postfix) with ESMTP; Fri, 7 Jul 2023 10:44:02 +0000 (GMT) From: Niklas Schnelle To: Paolo Abeni , Alexandra Winter , Wenjia Zhang , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Christian Borntraeger , Sven Schnelle , Stefan Raspl , "David S. Miller" , Jan Karcher Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net v2 3/3] s390/ism: Do not unregister clients with registered DMBs Date: Fri, 7 Jul 2023 12:43:59 +0200 Message-Id: <20230707104359.3324039-4-schnelle@linux.ibm.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230707104359.3324039-1-schnelle@linux.ibm.com> References: <20230707104359.3324039-1-schnelle@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-ORIG-GUID: MzfvT2oZq5ivVFuzWudenQfOz_mazAC- X-Proofpoint-GUID: OqOJMU7ONgozHh55kkrFxnHTPIudG_Ho X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-07_06,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 clxscore=1015 lowpriorityscore=0 adultscore=0 mlxlogscore=999 bulkscore=0 malwarescore=0 impostorscore=0 priorityscore=1501 spamscore=0 suspectscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307070097 X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770759523976551731?= X-GMAIL-MSGID: =?utf-8?q?1770759523976551731?= When ism_unregister_client() is called but the client still has DMBs registered it returns -EBUSY and prints an error. This only happens after the client has already been unregistered however. This is unexpected as the unregister claims to have failed. Furthermore as this implies a client bug a WARN() is more appropriate. Thus move the deregistration after the check and use WARN(). Fixes: 89e7d2ba61b7 ("net/ism: Add new API for client registration") Signed-off-by: Niklas Schnelle --- drivers/s390/net/ism_drv.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/drivers/s390/net/ism_drv.c b/drivers/s390/net/ism_drv.c index 54091b7aea16..6df7f377d2f9 100644 --- a/drivers/s390/net/ism_drv.c +++ b/drivers/s390/net/ism_drv.c @@ -96,29 +96,32 @@ int ism_unregister_client(struct ism_client *client) int rc = 0; mutex_lock(&ism_dev_list.mutex); - mutex_lock(&clients_lock); - clients[client->id] = NULL; - if (client->id + 1 == max_client) - max_client--; - mutex_unlock(&clients_lock); list_for_each_entry(ism, &ism_dev_list.list, list) { spin_lock_irqsave(&ism->lock, flags); /* Stop forwarding IRQs and events */ ism->subs[client->id] = NULL; for (int i = 0; i < ISM_NR_DMBS; ++i) { if (ism->sba_client_arr[i] == client->id) { - pr_err("%s: attempt to unregister client '%s'" - "with registered dmb(s)\n", __func__, - client->name); + WARN(1, "%s: attempt to unregister '%s' with registered dmb(s)\n", + __func__, client->name); rc = -EBUSY; - goto out; + goto err_reg_dmb; } } spin_unlock_irqrestore(&ism->lock, flags); } -out: mutex_unlock(&ism_dev_list.mutex); + mutex_lock(&clients_lock); + clients[client->id] = NULL; + if (client->id + 1 == max_client) + max_client--; + mutex_unlock(&clients_lock); + return rc; + +err_reg_dmb: + spin_unlock_irqrestore(&ism->lock, flags); + mutex_unlock(&ism_dev_list.mutex); return rc; } EXPORT_SYMBOL_GPL(ism_unregister_client);