netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cnic: Give a chance for the uio device to be opened before failing the path request
@ 2010-04-08 21:34 Benjamin Li
  2010-04-09 22:49 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Benjamin Li @ 2010-04-08 21:34 UTC (permalink / raw)
  To: netdev@vger.kernel.org, Michael Chan; +Cc: Benjamin Li, Eddie Wai

There is a timing condition; where the time between the CNIC's
/dev/uio* device registration and then the issuing of path requests
messages is faster the brcm_iscsiuio daemon initializing.

This can be seen if one sets the machine to automatically login into
iSCSI targets.  Then reset the network and iscsi daemons in quick
succession.  The login will fail because iscsid will only try
a couple of times in quick succession.  This patch will allow some
additional needed time for the brcm_iscsiuio daemon to initialize
before failing the path request call.

Signed-off-by: Benjamin Li <benli@broadcom.com>
Signed-off-by: Eddie Wai <waie@broadcom.com>
---
 drivers/net/cnic.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/drivers/net/cnic.c b/drivers/net/cnic.c
index 9781942..897f171 100644
--- a/drivers/net/cnic.c
+++ b/drivers/net/cnic.c
@@ -274,9 +274,17 @@ static int cnic_send_nlmsg(struct cnic_local *cp, u32 type,
 	u16 len = 0;
 	u32 msg_type = ISCSI_KEVENT_IF_DOWN;
 	struct cnic_ulp_ops *ulp_ops;
+	int count = 0;
 
-	if (cp->uio_dev == -1)
+	while (count < 40 && cp->uio_dev == -1) {
+		msleep(50);
+		count++;
+	}
+
+	if (cp->uio_dev == -1) {
+		netdev_warn(cp->dev->netdev, "no uio dev to send nl request\n");
 		return -ENODEV;
+	}
 
 	if (csk) {
 		len = sizeof(path_req);
-- 
1.6.1.2



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] cnic: Give a chance for the uio device to be opened before failing the path request
  2010-04-08 21:34 [PATCH] cnic: Give a chance for the uio device to be opened before failing the path request Benjamin Li
@ 2010-04-09 22:49 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2010-04-09 22:49 UTC (permalink / raw)
  To: benli; +Cc: netdev, mchan, waie

From: "Benjamin Li" <benli@broadcom.com>
Date: Thu, 8 Apr 2010 14:34:28 -0700

> There is a timing condition; where the time between the CNIC's
> /dev/uio* device registration and then the issuing of path requests
> messages is faster the brcm_iscsiuio daemon initializing.
> 
> This can be seen if one sets the machine to automatically login into
> iSCSI targets.  Then reset the network and iscsi daemons in quick
> succession.  The login will fail because iscsid will only try
> a couple of times in quick succession.  This patch will allow some
> additional needed time for the brcm_iscsiuio daemon to initialize
> before failing the path request call.
> 
> Signed-off-by: Benjamin Li <benli@broadcom.com>
> Signed-off-by: Eddie Wai <waie@broadcom.com>

You need to create a proper serialization scheme to fix this.

Any delay value you choose is arbitrary, and could be easily exceeded
if swapping or other expensive operations are in propgress at the time
of the regristration.

Therefore all delay based schemes have a failure mode and therefore
isn't the way to fix this properly.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-04-09 22:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-08 21:34 [PATCH] cnic: Give a chance for the uio device to be opened before failing the path request Benjamin Li
2010-04-09 22:49 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).