Commit 0d206a3a authored by Mitch Williams's avatar Mitch Williams Committed by John W. Linville

[PATCH] bonding: move kmalloc out of spinlock in ALB init

Move memory allocations out of the spinlock during ALB init.  This gets
rid of a sleeping-inside-spinlock warning and accompanying stack dump.
Signed-off-by: default avatarMitch Williams <mitch.a.williams@intel.com>
Acked-by: default avatarJay Vosburgh <fubar@us.ibm.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 0f418b2a
...@@ -198,20 +198,21 @@ static int tlb_initialize(struct bonding *bond) ...@@ -198,20 +198,21 @@ static int tlb_initialize(struct bonding *bond)
{ {
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
int size = TLB_HASH_TABLE_SIZE * sizeof(struct tlb_client_info); int size = TLB_HASH_TABLE_SIZE * sizeof(struct tlb_client_info);
struct tlb_client_info *new_hashtbl;
int i; int i;
spin_lock_init(&(bond_info->tx_hashtbl_lock)); spin_lock_init(&(bond_info->tx_hashtbl_lock));
_lock_tx_hashtbl(bond); new_hashtbl = kmalloc(size, GFP_KERNEL);
if (!new_hashtbl) {
bond_info->tx_hashtbl = kmalloc(size, GFP_KERNEL);
if (!bond_info->tx_hashtbl) {
printk(KERN_ERR DRV_NAME printk(KERN_ERR DRV_NAME
": %s: Error: Failed to allocate TLB hash table\n", ": %s: Error: Failed to allocate TLB hash table\n",
bond->dev->name); bond->dev->name);
_unlock_tx_hashtbl(bond);
return -1; return -1;
} }
_lock_tx_hashtbl(bond);
bond_info->tx_hashtbl = new_hashtbl;
memset(bond_info->tx_hashtbl, 0, size); memset(bond_info->tx_hashtbl, 0, size);
...@@ -800,21 +801,22 @@ static int rlb_initialize(struct bonding *bond) ...@@ -800,21 +801,22 @@ static int rlb_initialize(struct bonding *bond)
{ {
struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond));
struct packet_type *pk_type = &(BOND_ALB_INFO(bond).rlb_pkt_type); struct packet_type *pk_type = &(BOND_ALB_INFO(bond).rlb_pkt_type);
struct rlb_client_info *new_hashtbl;
int size = RLB_HASH_TABLE_SIZE * sizeof(struct rlb_client_info); int size = RLB_HASH_TABLE_SIZE * sizeof(struct rlb_client_info);
int i; int i;
spin_lock_init(&(bond_info->rx_hashtbl_lock)); spin_lock_init(&(bond_info->rx_hashtbl_lock));
_lock_rx_hashtbl(bond); new_hashtbl = kmalloc(size, GFP_KERNEL);
if (!new_hashtbl) {
bond_info->rx_hashtbl = kmalloc(size, GFP_KERNEL);
if (!bond_info->rx_hashtbl) {
printk(KERN_ERR DRV_NAME printk(KERN_ERR DRV_NAME
": %s: Error: Failed to allocate RLB hash table\n", ": %s: Error: Failed to allocate RLB hash table\n",
bond->dev->name); bond->dev->name);
_unlock_rx_hashtbl(bond);
return -1; return -1;
} }
_lock_rx_hashtbl(bond);
bond_info->rx_hashtbl = new_hashtbl;
bond_info->rx_hashtbl_head = RLB_NULL_INDEX; bond_info->rx_hashtbl_head = RLB_NULL_INDEX;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment