From: Allan Stephens Date: Fri, 3 Sep 2010 08:33:42 +0000 (+0000) Subject: tipc: Fix misleading error code when enabling Ethernet bearers X-Git-Tag: MMI-PSA29.97-13-9~21994^2~569 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=d1fb62796cdac6899ebd4319e4a610684db063e9;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git tipc: Fix misleading error code when enabling Ethernet bearers Cause TIPC to return EAGAIN if it is unable to enable a new Ethernet bearer because one or more recently disabled Ethernet bearers are temporarily consuming resources during shut down. (The previous error code, EDQUOT, is now returned only if all available Ethernet bearer data structures are fully enabled at the time the request to enable an additional bearer is received.) Signed-off-by: Allan Stephens Signed-off-by: Paul Gortmaker Signed-off-by: David S. Miller --- diff --git a/net/tipc/eth_media.c b/net/tipc/eth_media.c index 81253d0b24b9..673fdf0b3222 100644 --- a/net/tipc/eth_media.c +++ b/net/tipc/eth_media.c @@ -142,6 +142,16 @@ static int enable_bearer(struct tipc_bearer *tb_ptr) struct eth_bearer *eb_ptr = ð_bearers[0]; struct eth_bearer *stop = ð_bearers[MAX_ETH_BEARERS]; char *driver_name = strchr((const char *)tb_ptr->name, ':') + 1; + int pending_dev = 0; + + /* Find unused Ethernet bearer structure */ + + while (eb_ptr->dev) { + if (!eb_ptr->bearer) + pending_dev++; + if (++eb_ptr == stop) + return pending_dev ? -EAGAIN : -EDQUOT; + } /* Find device with specified name */