From: Holger Brunck <holger.brunck@keymile.com>
To: David Lamparter <equinox@diac24.net>
Cc: David Miller <davem@davemloft.net>,
netdev@vger.kernel.org, shemminger@vyatta.com,
bridge@lists.linux-foundation.org
Subject: Re: [PATCH] net, bridge: print log message after state changed
Date: Fri, 18 Nov 2011 10:20:10 +0100 [thread overview]
Message-ID: <4EC6234A.1030002@keymile.com> (raw)
In-Reply-To: <20111117192353.GD2051622@jupiter.n2.diac24.net>
On 11/17/2011 08:23 PM, David Lamparter wrote:
> On Mon, Nov 14, 2011 at 02:07:49AM -0500, David Miller wrote:
>>>> The message is therefore appropriately timed as far as I'm concerned.
>>>>
>>>
>>> It's not.
>>>
>>> Please test: create a bridge with STP disabled, add an interface to the
>>> bridge and set that interface down. You get the message "... entering
>>> forwarding state". That's wrong because it's "about to enter" disabled
>>> state some lines later.
>>>
>>> All other (4) calls to br_log_state are located after the state change,
>>> see for example br_stp_enable_port() just some lines above the patch.
>>
>> I would never expect an "entering" message to print out after the event
>> happens, and in fact I'd _always_ want to see it beforehand so that if
>> the state change caused a crash or similar it'd be that much easier
>> to pinpoint the proper location.
>
> There seems to be a misunderstanding here. The patch effectively does:
> - br_log_state(p);
> p->state = BR_STATE_DISABLED;
> + br_log_state(p);
>
> and the issue it is trying to fix is not the timing but rather the code
> printing the wrong (old, now-left) state.
>
Yes exactly this is the problem. We got confusing state messages in the current
implementation.
> I do agree that the log message should be printed before anything
> happens, so, Holger, can you brew a patch that does that?
>
This can't be changed easily. Because in some situations we don't know which
state we will enter at the entry point of the function.
For example br_make_forwarding does something like
if ..
p->state = STATE_A
else if ...
p->state = STATE_B
....
So my approach would be to change the log message from "port entering state" to
"port entered state" and print it out after the state changed.
Regards
Holger
prev parent reply other threads:[~2011-11-18 9:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-10 16:18 [PATCH] net, bridge: print log message after state changed Holger Brunck
2011-11-14 5:37 ` David Miller
2011-11-14 7:03 ` Fritz, Wolfgang
2011-11-14 7:07 ` David Miller
2011-11-14 9:10 ` Fritz, Wolfgang
2011-11-14 14:27 ` Joe Perches
2011-11-17 19:23 ` David Lamparter
2011-11-17 22:40 ` Stephen Hemminger
2011-11-18 9:20 ` Holger Brunck [this message]
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=4EC6234A.1030002@keymile.com \
--to=holger.brunck@keymile.com \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=equinox@diac24.net \
--cc=netdev@vger.kernel.org \
--cc=shemminger@vyatta.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).