All of lore.kernel.org
 help / color / mirror / Atom feed
* Reply: [net] bonding: use return instead of goto
@ 2016-02-05  1:42 张胜举
  2016-02-05 21:24 ` Jarod Wilson
  0 siblings, 1 reply; 3+ messages in thread
From: 张胜举 @ 2016-02-05  1:42 UTC (permalink / raw)
  To: 'Jarod Wilson'; +Cc: j.vosburgh, netdev

> On Wed, Feb 03, 2016 at 06:15:22AM +0000, Zhang Shengju wrote:
> > Replace 'goto' with 'return' to remove unnecessary check at label:
> > err_undo_flags.
> 
> I think you're going to have to explain how you came to the conclusion
that
> the check isn't necessary.
> 
> --
> Jarod Wilson
> jarod@redhat.com
Hi Jarod,

The reason is that 'err_undo_flags' do two things for the first slave
device:
1. revert bond mac address if it is set by the slave device.
2. revert bond device type if it's not ARPHRD_ETHER.

I think it's not necessary for the three places, they changed neither  bond
mac address nor type. 
it's straightforward to return directly.

Thanks,
Shengju

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Reply: [net] bonding: use return instead of goto
  2016-02-05  1:42 Reply: [net] bonding: use return instead of goto 张胜举
@ 2016-02-05 21:24 ` Jarod Wilson
  2016-02-06 11:05   ` 张胜举
  0 siblings, 1 reply; 3+ messages in thread
From: Jarod Wilson @ 2016-02-05 21:24 UTC (permalink / raw)
  To: 张胜举; +Cc: j.vosburgh, netdev

On Fri, Feb 05, 2016 at 09:42:24AM +0800, 张胜举 wrote:
> > On Wed, Feb 03, 2016 at 06:15:22AM +0000, Zhang Shengju wrote:
> > > Replace 'goto' with 'return' to remove unnecessary check at label:
> > > err_undo_flags.
> > 
> > I think you're going to have to explain how you came to the conclusion
> > that the check isn't necessary.
...
> The reason is that 'err_undo_flags' do two things for the first slave
> device:
> 1. revert bond mac address if it is set by the slave device.
> 2. revert bond device type if it's not ARPHRD_ETHER.
> 
> I think it's not necessary for the three places, they changed neither  bond
> mac address nor type. 
> it's straightforward to return directly.

I see what you're saying, and that does look to be true if you're only
adding a singular first device right now. But looking at the enslave and
release paths, I don't see anything preventing concurrent slave adds and
removes, which could mean there are situations where those checks really
are necessary. I don't actually know.

-- 
Jarod Wilson
jarod@redhat.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Reply: [net] bonding: use return instead of goto
  2016-02-05 21:24 ` Jarod Wilson
@ 2016-02-06 11:05   ` 张胜举
  0 siblings, 0 replies; 3+ messages in thread
From: 张胜举 @ 2016-02-06 11:05 UTC (permalink / raw)
  To: 'Jarod Wilson'; +Cc: j.vosburgh, netdev

> On Fri, Feb 05, 2016 at 09:42:24AM +0800, 张胜举 wrote:
> > > On Wed, Feb 03, 2016 at 06:15:22AM +0000, Zhang Shengju wrote:
> > > > Replace 'goto' with 'return' to remove unnecessary check at label:
> > > > err_undo_flags.
> > >
> > > I think you're going to have to explain how you came to the
> > > conclusion that the check isn't necessary.
> ...
> > The reason is that 'err_undo_flags' do two things for the first slave
> > device:
> > 1. revert bond mac address if it is set by the slave device.
> > 2. revert bond device type if it's not ARPHRD_ETHER.
> >
> > I think it's not necessary for the three places, they changed neither
> > bond mac address nor type.
> > it's straightforward to return directly.
> 
> I see what you're saying, and that does look to be true if you're only adding a
> singular first device right now. But looking at the enslave and release paths, I
> don't see anything preventing concurrent slave adds and removes, which
> could mean there are situations where those checks really are necessary. I
> don't actually know.
> 
> --
> Jarod Wilson
> jarod@redhat.com

All of three places don't change any attributes of bond device, 
just for sanity check before enslaving.  
If it's necessary for these three places to goto 'err_undo_flags',  
it will mean that all sanity checks before these three places need to do so, which is not right clearly. 

Even there is concurrent situation which make the check necessary, which I haven't figure out yet,
it's not right place to do this.  

Thanks,
Shengju

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-02-06 11:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-02-05  1:42 Reply: [net] bonding: use return instead of goto 张胜举
2016-02-05 21:24 ` Jarod Wilson
2016-02-06 11:05   ` 张胜举

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.