Skip to content

Commit d1fb627

Browse files
ajstephensdavem330
authored andcommitted
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 <allan.stephens@windriver.com> Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 9fbfca0 commit d1fb627

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

net/tipc/eth_media.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,16 @@ static int enable_bearer(struct tipc_bearer *tb_ptr)
142142
struct eth_bearer *eb_ptr = &eth_bearers[0];
143143
struct eth_bearer *stop = &eth_bearers[MAX_ETH_BEARERS];
144144
char *driver_name = strchr((const char *)tb_ptr->name, ':') + 1;
145+
int pending_dev = 0;
146+
147+
/* Find unused Ethernet bearer structure */
148+
149+
while (eb_ptr->dev) {
150+
if (!eb_ptr->bearer)
151+
pending_dev++;
152+
if (++eb_ptr == stop)
153+
return pending_dev ? -EAGAIN : -EDQUOT;
154+
}
145155

146156
/* Find device with specified name */
147157

0 commit comments

Comments
 (0)