cnic: Give a chance for the uio device to be opened before failing the path request
Subsystems (2)
PATCH 1/1 cnic: Give a chance for the uio device to be opened before failing the path request
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.
--- drivers/net/cnic.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-)
drivers/net/cnic.c +9 -1
@@ -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);
Signature · 1 line
1.6.1.2
David Miller
maintainerFrom: "Benjamin Li" <[email protected]>
Date: Thu, 8 Apr 2010 14:34:28 -0700
Quoted 11 lines
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 thebrcm_iscsiuiodaemon 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_iscsiuiodaemon to initialize before failing the path request call.
Quoted 2 lines
Signed-off-by Benjamin Li <[email protected]>Signed-off-by Eddie Wai <[email protected]>
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.