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

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.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parents 5e724cb6 0066623d
Loading
Loading
Loading
Loading
+2 −3
Original line number Diff line number Diff line
@@ -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: