Commit 2a4183f8 authored by Jakub Kicinski's avatar Jakub Kicinski

Merge branch 'netconsole-fix-potential-race-condition-and-improve-code-clarity'

Breno Leitao says:

====================
netconsole: improve code clarity

These changes aim to enhance the reliability of netconsole by
eliminating the potential race condition and improve maintainability
by making the code more straightforward to understand and modify.
====================

Link: https://patch.msgid.link/20240709144403.544099-1-leitao@debian.orgSigned-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 5e724cb6 0066623d
......@@ -344,7 +344,7 @@ static ssize_t enabled_store(struct config_item *item,
goto out_unlock;
err = -EINVAL;
if ((bool)enabled == nt->enabled) {
if (enabled == nt->enabled) {
pr_info("network logging has already %s\n",
nt->enabled ? "started" : "stopped");
goto out_unlock;
......@@ -369,6 +369,7 @@ static ssize_t enabled_store(struct config_item *item,
if (err)
goto out_unlock;
nt->enabled = true;
pr_info("network logging started\n");
} else { /* false */
/* We need to disable the netconsole before cleaning it up
......@@ -381,8 +382,6 @@ static ssize_t enabled_store(struct config_item *item,
netpoll_cleanup(&nt->np);
}
nt->enabled = enabled;
mutex_unlock(&dynamic_netconsole_mutex);
return strnlen(buf, count);
out_unlock:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment