public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: amwang@redhat.com
Cc: netdev@vger.kernel.org
Subject: re: bonding: sync netpoll code with bridge
Date: Wed, 25 Jul 2012 16:47:10 +0300	[thread overview]
Message-ID: <20120725134710.GA25625@elgon.mountain> (raw)

Hello Amerigo Wang,

The patch 8a8efa22f51b: "bonding: sync netpoll code with bridge" from 
Feb 17, 2011, leads to the following warning:
drivers/net/bonding/bond_main.c:1849 bond_enslave()
	 error: scheduling with locks held: 'read_lock:&bond->lock'

drivers/net/bonding/bond_main.c
  1301          read_lock(&bond->lock);
  1302          bond_for_each_slave(bond, slave, i) {
  1303                  err = slave_enable_netpoll(slave);
                              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
This can lead to a scheduling while atomic bug because it does a
GFP_KERNEL allocation and calls __netpoll_setup() which sleeps.

  1304                  if (err) {
  1305                          __bond_netpoll_cleanup(bond);
  1306                          break;
  1307                  }
  1308          }
  1309          read_unlock(&bond->lock);

Also later in the file:

  1848          if (slave_dev->npinfo) {
  1849                  if (slave_enable_netpoll(new_slave)) {
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
We are holding read_lock(&bond->lock);

  1850                          read_unlock(&bond->lock);
  1851                          pr_info("Error, %s: master_dev is using netpoll, "
  1852                                   "but new slave device does not support netpoll.\n",
  1853                                   bond_dev->name);
  1854                          res = -EBUSY;
  1855                          goto err_detach;
  1856                  }

The easy way to trigger this warning is to test with
CONFIG_DEBUG_ATOMIC_SLEEP=y.

regards,
dan carpenter

             reply	other threads:[~2012-07-25 13:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-25 13:47 Dan Carpenter [this message]
2012-07-26  7:15 ` bonding: sync netpoll code with bridge Cong Wang
2012-07-26  8:17   ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120725134710.GA25625@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=amwang@redhat.com \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox