public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Pirko <jpirko@redhat.com>
To: Ben Hutchings <bhutchings@solarflare.com>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
	eric.dumazet@gmail.com, shemminger@vyatta.com
Subject: Re: [patch net-next-2.6] net: allow notifier subscribers to forbid device from closing
Date: Wed, 31 Aug 2011 18:21:48 +0200	[thread overview]
Message-ID: <20110831162147.GA2051@minipsycho.redhat.com> (raw)
In-Reply-To: <1314804352.2741.4.camel@bwh-desktop>

Wed, Aug 31, 2011 at 05:25:51PM CEST, bhutchings@solarflare.com wrote:
>On Wed, 2011-08-31 at 17:15 +0200, Jiri Pirko wrote:
>> In some situations, like when the device is used as slave device in
>> bond/br/etc it is not nice if someone closes the device. This allows
>> it's masters to forbid this closure.
>
>No it doesn't.
It does

>
>[...]
>> @@ -1269,9 +1282,12 @@ static int dev_close_many(struct list_head *head)
>>  	struct net_device *dev, *tmp;
>>  	LIST_HEAD(tmp_list);
>>  
>> -	list_for_each_entry_safe(dev, tmp, head, unreg_list)
>> +	list_for_each_entry_safe(dev, tmp, head, unreg_list) {
>>  		if (!(dev->flags & IFF_UP))
>>  			list_move(&dev->unreg_list, &tmp_list);
>> +		else
>> +			__dev_pre_close(dev);
>> +	}
>>  
>>  	__dev_close_many(head);
>
>The return value is ignored here.

That's intended. The reason is this is called from
rollback_registered_many - refuse should be ignored in that case
>
>And this is called from dev_close(), where you are adding the
>notification as well.  So the notifier will usually be called twice.
>
Indeed. Anyway I thought about it and we probably do not need this patch
as Stephen said.

>[...]
>> @@ -1397,6 +1418,7 @@ rollback:
>>  				break;
>>  
>>  			if (dev->flags & IFF_UP) {
>> +				nb->notifier_call(nb, NETDEV_PRE_DOWN, dev);
>>  				nb->notifier_call(nb, NETDEV_GOING_DOWN, dev);
>>  				nb->notifier_call(nb, NETDEV_DOWN, dev);
>>  			}
>[...]
>
>The return value has to be ignored here.  Not sure it makes any sense to
>call the notifier at all.
>
>Ben.
>
>-- 
>Ben Hutchings, Staff Engineer, Solarflare
>Not speaking for my employer; that's the marketing department's job.
>They asked us to note that Solarflare product names are trademarked.
>

      parent reply	other threads:[~2011-08-31 16:21 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-31 15:15 [patch net-next-2.6] net: allow notifier subscribers to forbid device from closing Jiri Pirko
2011-08-31 15:20 ` Stephen Hemminger
2011-08-31 15:25 ` Ben Hutchings
2011-08-31 15:53   ` Stephen Hemminger
2011-08-31 16:22     ` Jiri Pirko
2011-08-31 16:21   ` Jiri Pirko [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=20110831162147.GA2051@minipsycho.redhat.com \
    --to=jpirko@redhat.com \
    --cc=bhutchings@solarflare.com \
    --cc=davem@davemloft.net \
    --cc=eric.dumazet@gmail.com \
    --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