Skip to content

Commit 908ee29

Browse files
leitaokuba-moo
authored andcommitted
net: netconsole: Populate dynamic entry even if netpoll fails
Currently, netconsole discards targets that fail during initialization, causing two issues: 1) Inconsistency between target list and configfs entries * user pass cmdline0, cmdline1. If cmdline0 fails, then cmdline1 becomes cmdline0 in configfs. 2) Inability to manage failed targets from userspace * If user pass a target that fails with netpoll (interface not loaded at netcons initialization time, such as interface is a module), then the target will not exist in the configfs, so, user cannot re-enable or modify it from userspace. Failed targets are now added to the target list and configfs, but remain disabled until manually enabled or reconfigured. This change does not change the behaviour if CONFIG_NETCONSOLE_DYNAMIC is not set. CC: Aijay Adams <[email protected]> Signed-off-by: Breno Leitao <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent ae5a045 commit 908ee29

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

drivers/net/netconsole.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1258,11 +1258,18 @@ static struct netconsole_target *alloc_param_target(char *target_config,
12581258
goto fail;
12591259

12601260
err = netpoll_setup(&nt->np);
1261-
if (err)
1262-
goto fail;
1263-
1261+
if (err) {
1262+
pr_err("Not enabling netconsole for %s%d. Netpoll setup failed\n",
1263+
NETCONSOLE_PARAM_TARGET_PREFIX, cmdline_count);
1264+
if (!IS_ENABLED(CONFIG_NETCONSOLE_DYNAMIC))
1265+
/* only fail if dynamic reconfiguration is set,
1266+
* otherwise, keep the target in the list, but disabled.
1267+
*/
1268+
goto fail;
1269+
} else {
1270+
nt->enabled = true;
1271+
}
12641272
populate_configfs_item(nt, cmdline_count);
1265-
nt->enabled = true;
12661273

12671274
return nt;
12681275

0 commit comments

Comments
 (0)