aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVeaceslav Falico <vfalico@redhat.com>2014-03-06 09:33:22 -0500
committerDavid S. Miller <davem@davemloft.net>2014-03-06 15:19:43 -0500
commit072256d1f2b8ba0bbb265d590c703f3d57a39d6a (patch)
tree0eef5201115e3d8487a7b9a4e1fac6fa1c8183ed
parente90c14835ba2e1d3f82b8f24e429b971725afff5 (diff)
bonding: make slave status notifications GFP_ATOMIC
Currently we're using GFP_KERNEL, however there are some path(s) where we can hold some spinlocks, specifically bond->curr_slave_lock: [ 4.722916] BUG: sleeping function called from invalid context at mm/slub.c:965 [ 4.724438] in_atomic(): 1, irqs_disabled(): 0, pid: 940, name: ifup-eth [ 4.726034] 5 locks held by ifup-eth/940: ...snip... [ 4.734646] #4: (&bond->curr_slave_lock){+...+.}, at: [<ffffffffa00badc6>] bond_enslave+0xda6/0xdd0 [bonding] ...snip... [ 4.759081] [<ffffffffa00b6f11>] bond_change_active_slave+0x191/0x3b0 [bonding] [ 4.760917] [<ffffffffa00b7227>] bond_select_active_slave+0xf7/0x1d0 [bonding] [ 4.762751] [<ffffffffa00badce>] bond_enslave+0xdae/0xdd0 [bonding] ...snip... As it's out of hot path and is a really rare event - change the gfp_t flags to GFP_ATOMIC to avoid sleeping under spinlock. v2: convert new notify calls to GFP_ATOMIC. CC: Thomas Glanzmann <thomas@glanzmann.de> CC: Ding Tianhong <dingtianhong@huawei.com> CC: Jay Vosburgh <fubar@us.ibm.com> CC: Andy Gospodarek <andy@greyhouse.net> Signed-off-by: Veaceslav Falico <vfalico@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/bonding/bonding.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/bonding/bonding.h b/drivers/net/bonding/bonding.h
index b7127a1ba2c9..63ee116adfab 100644
--- a/drivers/net/bonding/bonding.h
+++ b/drivers/net/bonding/bonding.h
@@ -293,7 +293,7 @@ static inline void bond_set_active_slave(struct slave *slave)
293{ 293{
294 if (slave->backup) { 294 if (slave->backup) {
295 slave->backup = 0; 295 slave->backup = 0;
296 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_KERNEL); 296 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
297 } 297 }
298} 298}
299 299
@@ -301,7 +301,7 @@ static inline void bond_set_backup_slave(struct slave *slave)
301{ 301{
302 if (!slave->backup) { 302 if (!slave->backup) {
303 slave->backup = 1; 303 slave->backup = 1;
304 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_KERNEL); 304 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
305 } 305 }
306} 306}
307 307
@@ -313,7 +313,7 @@ static inline void bond_set_slave_state(struct slave *slave,
313 313
314 slave->backup = slave_state; 314 slave->backup = slave_state;
315 if (notify) { 315 if (notify) {
316 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_KERNEL); 316 rtmsg_ifinfo(RTM_NEWLINK, slave->dev, 0, GFP_ATOMIC);
317 slave->should_notify = 0; 317 slave->should_notify = 0;
318 } else { 318 } else {
319 if (slave->should_notify) 319 if (slave->should_notify)
@@ -343,7 +343,7 @@ static inline void bond_slave_state_notify(struct bonding *bond)
343 343
344 bond_for_each_slave(bond, tmp, iter) { 344 bond_for_each_slave(bond, tmp, iter) {
345 if (tmp->should_notify) { 345 if (tmp->should_notify) {
346 rtmsg_ifinfo(RTM_NEWLINK, tmp->dev, 0, GFP_KERNEL); 346 rtmsg_ifinfo(RTM_NEWLINK, tmp->dev, 0, GFP_ATOMIC);
347 tmp->should_notify = 0; 347 tmp->should_notify = 0;
348 } 348 }
349 } 349 }