netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] lec: Use rtnl lock/unlock when updating MTU
@ 2014-08-14 13:19 Chas Williams - CONTRACTOR
  2014-08-14 21:37 ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Chas Williams - CONTRACTOR @ 2014-08-14 13:19 UTC (permalink / raw)
  To: netdev, linux-atm-general

The LECS response contains the MTU that should be used.  Correctly
synchronize with other layers when updating.

Signed-off-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
---
 net/atm/lec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/net/atm/lec.c b/net/atm/lec.c
index 4c5b8ba..6e13369 100644
--- a/net/atm/lec.c
+++ b/net/atm/lec.c
@@ -410,9 +410,11 @@ static int lec_atm_send(struct atm_vcc *vcc, struct sk_buff *skb)
 		priv->lane2_ops = NULL;
 		if (priv->lane_version > 1)
 			priv->lane2_ops = &lane2_ops;
+		rtnl_lock();
 		if (dev_set_mtu(dev, mesg->content.config.mtu))
 			pr_info("%s: change_mtu to %d failed\n",
 				dev->name, mesg->content.config.mtu);
+		rtnl_unlock();
 		priv->is_proxy = mesg->content.config.is_proxy;
 		break;
 	case l_flush_tran_id:
-- 
1.9.3

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

* Re: [PATCH net-next] lec: Use rtnl lock/unlock when updating MTU
  2014-08-14 13:19 [PATCH net-next] lec: Use rtnl lock/unlock when updating MTU Chas Williams - CONTRACTOR
@ 2014-08-14 21:37 ` David Miller
  2014-08-15  0:56   ` Chas Williams (CONTRACTOR)
  0 siblings, 1 reply; 4+ messages in thread
From: David Miller @ 2014-08-14 21:37 UTC (permalink / raw)
  To: chas; +Cc: netdev, linux-atm-general

From: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
Date: Thu, 14 Aug 2014 09:19:47 -0400

> The LECS response contains the MTU that should be used.  Correctly
> synchronize with other layers when updating.
> 
> Signed-off-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>

I don't think you can sleep from this function, which rtnl_lock() may
require.  Look elsewhere in this routine, it's doing GFP_ATOMIC
allocations even.

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

* Re: [PATCH net-next] lec: Use rtnl lock/unlock when updating MTU
  2014-08-14 21:37 ` David Miller
@ 2014-08-15  0:56   ` Chas Williams (CONTRACTOR)
  2014-08-21 23:31     ` David Miller
  0 siblings, 1 reply; 4+ messages in thread
From: Chas Williams (CONTRACTOR) @ 2014-08-15  0:56 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux-atm-general

In message <20140814.143706.1833450188258591738.davem@redhat.com>,David Miller writes:
>From: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
>Date: Thu, 14 Aug 2014 09:19:47 -0400
>
>> The LECS response contains the MTU that should be used.  Correctly
>> synchronize with other layers when updating.
>> 
>> Signed-off-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
>
>I don't think you can sleep from this function, which rtnl_lock() may
>require.  Look elsewhere in this routine, it's doing GFP_ATOMIC
>allocations even.

Its been a while but...

This is the send routine for a virtual atm device that is the control
interface bewteen the user space client and the kernel.  The user space
client creates an atm socket and uses an ioctl to connect that atm socket
to the this virtual device.  So the call path is something like:

sendmsg() -> vcc_sendmsg() -> virtual atm device.send()

Generally speaking, you can't sleep in the send routine of an atm device
since there are other potential users besides sockets.

The GFP_ATOMIC usage is probably a lack of understanding.  The other
IRQ level locks are necessary for coordination.

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

* Re: [PATCH net-next] lec: Use rtnl lock/unlock when updating MTU
  2014-08-15  0:56   ` Chas Williams (CONTRACTOR)
@ 2014-08-21 23:31     ` David Miller
  0 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-08-21 23:31 UTC (permalink / raw)
  To: chas; +Cc: netdev, linux-atm-general

From: "Chas Williams (CONTRACTOR)" <chas@cmf.nrl.navy.mil>
Date: Thu, 14 Aug 2014 20:56:27 -0400

> In message <20140814.143706.1833450188258591738.davem@redhat.com>,David Miller writes:
>>From: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
>>Date: Thu, 14 Aug 2014 09:19:47 -0400
>>
>>> The LECS response contains the MTU that should be used.  Correctly
>>> synchronize with other layers when updating.
>>> 
>>> Signed-off-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
>>
>>I don't think you can sleep from this function, which rtnl_lock() may
>>require.  Look elsewhere in this routine, it's doing GFP_ATOMIC
>>allocations even.
> 
> Its been a while but...
> 
> This is the send routine for a virtual atm device that is the control
> interface bewteen the user space client and the kernel.  The user space
> client creates an atm socket and uses an ioctl to connect that atm socket
> to the this virtual device.  So the call path is something like:
> 
> sendmsg() -> vcc_sendmsg() -> virtual atm device.send()
> 
> Generally speaking, you can't sleep in the send routine of an atm device
> since there are other potential users besides sockets.
> 
> The GFP_ATOMIC usage is probably a lack of understanding.  The other
> IRQ level locks are necessary for coordination.

Ok, that makes sense, thanks for explaining the context in which this is
invoked.

Patch applied, thanks again.

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

end of thread, other threads:[~2014-08-21 23:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-14 13:19 [PATCH net-next] lec: Use rtnl lock/unlock when updating MTU Chas Williams - CONTRACTOR
2014-08-14 21:37 ` David Miller
2014-08-15  0:56   ` Chas Williams (CONTRACTOR)
2014-08-21 23:31     ` David Miller

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).