Skip to content

Commit

Permalink
netconsole: only set CON_PRINTBUFFER if the user specifies a netconsole
Browse files Browse the repository at this point in the history
Since 0bcc181 (netconsole: Support
dynamic reconfiguration using configfs), the netconsole is always
registered, regardless of whether the user actually specified a
netconsole configuration on the command line.

However because netconsole has CON_PRINTBUFFER set, when it is
registered it causes the printk buffer to be replayed to all consoles.
When there is no netconsole configured this is a) pointless, and b)
somewhat annoying for the user of the existing console.

So instead we should only set CON_PRINTBUFFER if there is a netconsole
configuration found on the command line. This retains the existing
behaviour if a netconsole is setup by the user, and avoids spamming
other consoles when we're only registering for the dynamic
netconsole case.

Signed-off-by: Michael Ellerman <michael@ellerman.id.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Michael Ellerman authored and David S. Miller committed Apr 15, 2008
1 parent 56690c2 commit 0517dee
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/net/netconsole.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ static void write_msg(struct console *con, const char *msg, unsigned int len)

static struct console netconsole = {
.name = "netcon",
.flags = CON_ENABLED | CON_PRINTBUFFER,
.flags = CON_ENABLED,
.write = write_msg,
};

Expand All @@ -749,6 +749,9 @@ static int __init init_netconsole(void)
err = PTR_ERR(nt);
goto fail;
}
/* Dump existing printks when we register */
netconsole.flags |= CON_PRINTBUFFER;

spin_lock_irqsave(&target_list_lock, flags);
list_add(&nt->list, &target_list);
spin_unlock_irqrestore(&target_list_lock, flags);
Expand Down

0 comments on commit 0517dee

Please sign in to comment.