From: Niklas Schnelle <schnelle@linux.ibm.com>
To: Paolo Abeni <pabeni@redhat.com>,
Alexandra Winter <wintera@linux.ibm.com>,
Wenjia Zhang <wenjia@linux.ibm.com>,
Jan Karcher <jaka@linux.ibm.com>,
Stefan Raspl <raspl@linux.ibm.com>,
"David S. Miller" <davem@davemloft.net>
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:56:22 +0200 [thread overview]
Message-ID: <20230707105622.3332261-4-schnelle@linux.ibm.com> (raw)
In-Reply-To: <20230707105622.3332261-1-schnelle@linux.ibm.com>
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 <schnelle@linux.ibm.com>
---
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);
--
2.39.2
next prev parent reply other threads:[~2023-07-07 10:56 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-07 10:56 [PATCH net v2 0/3] s390/ism: Fixes to client handling Niklas Schnelle
2023-07-07 10:56 ` [PATCH net v2 1/3] s390/ism: Fix locking for forwarding of IRQs and events to clients Niklas Schnelle
2023-07-07 13:37 ` Alexandra Winter
2023-07-07 14:08 ` Niklas Schnelle
2023-07-07 10:56 ` [PATCH net v2 2/3] s390/ism: Fix and simplify add()/remove() callback handling Niklas Schnelle
2023-07-07 10:56 ` Niklas Schnelle [this message]
2023-07-07 13:46 ` [PATCH net v2 0/3] s390/ism: Fixes to client handling Alexandra Winter
2023-07-07 20:19 ` Wenjia Zhang
2023-07-08 9:13 ` patchwork-bot+netdevbpf
[not found] <20230707104359.3324039-1-schnelle@linux.ibm.com>
2023-07-07 10:43 ` [PATCH net v2 3/3] s390/ism: Do not unregister clients with registered DMBs Niklas Schnelle
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230707105622.3332261-4-schnelle@linux.ibm.com \
--to=schnelle@linux.ibm.com \
--cc=davem@davemloft.net \
--cc=jaka@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=raspl@linux.ibm.com \
--cc=wenjia@linux.ibm.com \
--cc=wintera@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).