From: "Michael Chan" <mchan@broadcom.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org
Subject: [PATCH net-next 2/9] cnic: Prevent "scheduling while atomic" when calling ->cnic_init()
Date: Thu, 23 Dec 2010 09:42:57 -0800 [thread overview]
Message-ID: <1293126184-13097-3-git-send-email-mchan@broadcom.com> (raw)
In-Reply-To: <1293126184-13097-2-git-send-email-mchan@broadcom.com>
cnic_dev_list is protected by rtnl_lock and cnic_dev_lock spin_lock during
modifications. When looping on cnic_dev_list and calling ->cnic_init(),
we should just hold rtnl_lock since ->cnic_init() may sleep.
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/cnic.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 9c2e786..3a7d3ce 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -59,6 +59,7 @@ MODULE_DESCRIPTION("Broadcom NetXtreme II CNIC Driver");
MODULE_LICENSE("GPL");
MODULE_VERSION(CNIC_MODULE_VERSION);
+/* cnic_dev_list modifications are protected by both rtnl and cnic_dev_lock */
static LIST_HEAD(cnic_dev_list);
static LIST_HEAD(cnic_udev_list);
static DEFINE_RWLOCK(cnic_dev_lock);
@@ -445,14 +446,12 @@ int cnic_register_driver(int ulp_type, struct cnic_ulp_ops *ulp_ops)
/* Prevent race conditions with netdev_event */
rtnl_lock();
- read_lock(&cnic_dev_lock);
list_for_each_entry(dev, &cnic_dev_list, list) {
struct cnic_local *cp = dev->cnic_priv;
if (!test_and_set_bit(ULP_F_INIT, &cp->ulp_flags[ulp_type]))
ulp_ops->cnic_init(dev);
}
- read_unlock(&cnic_dev_lock);
rtnl_unlock();
return 0;
--
1.6.4.GIT
next prev parent reply other threads:[~2010-12-23 18:40 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-23 17:42 [PATCH net-next 0/9] cnic: Bug fixes and FCoE support Michael Chan
2010-12-23 17:42 ` [PATCH net-next 1/9] cnic: Fix iSCSI TCP port endian order Michael Chan
2010-12-23 17:42 ` Michael Chan [this message]
2010-12-23 17:42 ` [PATCH net-next 3/9] cnic: Improve ->iscsi_nl_msg_send() Michael Chan
2010-12-23 17:42 ` [PATCH net-next 4/9] cnic: Use proper client and connection IDs on iSCSI ring Michael Chan
2010-12-23 17:43 ` [PATCH net-next 5/9] cnic: Support NIC Partition mode Michael Chan
2010-12-23 17:43 ` Michael Chan
2010-12-23 17:43 ` [PATCH net-next 7/9] cnic: Call cm_connect_complete() immediately on error Michael Chan
2010-12-23 17:43 ` [PATCH net-next 8/9] cnic: Add kcq2 support on 57712 Michael Chan
2010-12-23 17:43 ` [PATCH net-next 9/9] cnic: Add FCoE " Michael Chan
2010-12-23 19:27 ` [PATCH net-next 0/9] cnic: Bug fixes and FCoE support David Miller
2010-12-23 19:29 ` Michael Chan
2010-12-23 20:01 ` David Miller
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=1293126184-13097-3-git-send-email-mchan@broadcom.com \
--to=mchan@broadcom.com \
--cc=davem@davemloft.net \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.