diff options
author | Mitch Williams <mitch.a.williams@intel.com> | 2005-11-09 13:35:30 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2005-11-13 14:48:19 -0500 |
commit | 0d206a3af4329bd833cfa5fe1cc7fe146e49c131 (patch) | |
tree | 755e5a7703e8bbed56429ff748ad4ee7963c02df /drivers/net | |
parent | 0f418b2ac49e97b7b763e0473320a201eec15ed3 (diff) |
[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: Mitch Williams <mitch.a.williams@intel.com>
Acked-by: Jay Vosburgh <fubar@us.ibm.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net')
-rw-r--r-- | drivers/net/bonding/bond_alb.c | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/drivers/net/bonding/bond_alb.c b/drivers/net/bonding/bond_alb.c index 96dfb90c5252..e8d10f3cb1b5 100644 --- a/drivers/net/bonding/bond_alb.c +++ b/drivers/net/bonding/bond_alb.c | |||
@@ -198,20 +198,21 @@ static int tlb_initialize(struct bonding *bond) | |||
198 | { | 198 | { |
199 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | 199 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); |
200 | int size = TLB_HASH_TABLE_SIZE * sizeof(struct tlb_client_info); | 200 | int size = TLB_HASH_TABLE_SIZE * sizeof(struct tlb_client_info); |
201 | struct tlb_client_info *new_hashtbl; | ||
201 | int i; | 202 | int i; |
202 | 203 | ||
203 | spin_lock_init(&(bond_info->tx_hashtbl_lock)); | 204 | spin_lock_init(&(bond_info->tx_hashtbl_lock)); |
204 | 205 | ||
205 | _lock_tx_hashtbl(bond); | 206 | new_hashtbl = kmalloc(size, GFP_KERNEL); |
206 | 207 | if (!new_hashtbl) { | |
207 | bond_info->tx_hashtbl = kmalloc(size, GFP_KERNEL); | ||
208 | if (!bond_info->tx_hashtbl) { | ||
209 | printk(KERN_ERR DRV_NAME | 208 | printk(KERN_ERR DRV_NAME |
210 | ": %s: Error: Failed to allocate TLB hash table\n", | 209 | ": %s: Error: Failed to allocate TLB hash table\n", |
211 | bond->dev->name); | 210 | bond->dev->name); |
212 | _unlock_tx_hashtbl(bond); | ||
213 | return -1; | 211 | return -1; |
214 | } | 212 | } |
213 | _lock_tx_hashtbl(bond); | ||
214 | |||
215 | bond_info->tx_hashtbl = new_hashtbl; | ||
215 | 216 | ||
216 | memset(bond_info->tx_hashtbl, 0, size); | 217 | memset(bond_info->tx_hashtbl, 0, size); |
217 | 218 | ||
@@ -800,21 +801,22 @@ static int rlb_initialize(struct bonding *bond) | |||
800 | { | 801 | { |
801 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); | 802 | struct alb_bond_info *bond_info = &(BOND_ALB_INFO(bond)); |
802 | struct packet_type *pk_type = &(BOND_ALB_INFO(bond).rlb_pkt_type); | 803 | struct packet_type *pk_type = &(BOND_ALB_INFO(bond).rlb_pkt_type); |
804 | struct rlb_client_info *new_hashtbl; | ||
803 | int size = RLB_HASH_TABLE_SIZE * sizeof(struct rlb_client_info); | 805 | int size = RLB_HASH_TABLE_SIZE * sizeof(struct rlb_client_info); |
804 | int i; | 806 | int i; |
805 | 807 | ||
806 | spin_lock_init(&(bond_info->rx_hashtbl_lock)); | 808 | spin_lock_init(&(bond_info->rx_hashtbl_lock)); |
807 | 809 | ||
808 | _lock_rx_hashtbl(bond); | 810 | new_hashtbl = kmalloc(size, GFP_KERNEL); |
809 | 811 | if (!new_hashtbl) { | |
810 | bond_info->rx_hashtbl = kmalloc(size, GFP_KERNEL); | ||
811 | if (!bond_info->rx_hashtbl) { | ||
812 | printk(KERN_ERR DRV_NAME | 812 | printk(KERN_ERR DRV_NAME |
813 | ": %s: Error: Failed to allocate RLB hash table\n", | 813 | ": %s: Error: Failed to allocate RLB hash table\n", |
814 | bond->dev->name); | 814 | bond->dev->name); |
815 | _unlock_rx_hashtbl(bond); | ||
816 | return -1; | 815 | return -1; |
817 | } | 816 | } |
817 | _lock_rx_hashtbl(bond); | ||
818 | |||
819 | bond_info->rx_hashtbl = new_hashtbl; | ||
818 | 820 | ||
819 | bond_info->rx_hashtbl_head = RLB_NULL_INDEX; | 821 | bond_info->rx_hashtbl_head = RLB_NULL_INDEX; |
820 | 822 | ||