Mercurial > illumos > illumos-gate
changeset 8575:586f608c7ab7
6794368 iscsi client broken: failed to receive login response
author | shenjian |
---|---|
date | Tue, 20 Jan 2009 14:46:11 +0800 |
parents | 34b33d2c8168 |
children | 9cdc68d0502f |
files | usr/src/uts/common/fs/sockfs/sockcommon_sops.c usr/src/uts/common/fs/sockfs/sockcommon_subr.c usr/src/uts/common/fs/sockfs/socktpi.c usr/src/uts/common/io/scsi/adapters/iscsi/iscsi_net.c |
diffstat | 4 files changed, 58 insertions(+), 23 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/uts/common/fs/sockfs/sockcommon_sops.c Mon Jan 19 22:27:58 2009 -0800 +++ b/usr/src/uts/common/fs/sockfs/sockcommon_sops.c Tue Jan 20 14:46:11 2009 +0800 @@ -783,7 +783,8 @@ struct timeval tl; clock_t t_usec; - if (get_udatamodel() == DATAMODEL_NATIVE) { + if (get_udatamodel() == DATAMODEL_NONE || + get_udatamodel() == DATAMODEL_NATIVE) { if (optlen != sizeof (struct timeval)) { error = EINVAL; goto done;
--- a/usr/src/uts/common/fs/sockfs/sockcommon_subr.c Mon Jan 19 22:27:58 2009 -0800 +++ b/usr/src/uts/common/fs/sockfs/sockcommon_subr.c Tue Jan 20 14:46:11 2009 +0800 @@ -1592,7 +1592,9 @@ case SO_RCVTIMEO: { clock_t value; socklen_t optlen = *optlenp; - if (get_udatamodel() == DATAMODEL_NATIVE) { + + if (get_udatamodel() == DATAMODEL_NONE || + get_udatamodel() == DATAMODEL_NATIVE) { if (optlen < sizeof (struct timeval)) return (EINVAL); } else { @@ -1604,7 +1606,8 @@ else value = drv_hztousec(so->so_sndtimeo); - if (get_udatamodel() == DATAMODEL_NATIVE) { + if (get_udatamodel() == DATAMODEL_NONE || + get_udatamodel() == DATAMODEL_NATIVE) { ((struct timeval *)(optval))->tv_sec = value / (1000 * 1000); ((struct timeval *)(optval))->tv_usec =
--- a/usr/src/uts/common/fs/sockfs/socktpi.c Mon Jan 19 22:27:58 2009 -0800 +++ b/usr/src/uts/common/fs/sockfs/socktpi.c Tue Jan 20 14:46:11 2009 +0800 @@ -5204,7 +5204,8 @@ break; case SO_RCVTIMEO: case SO_SNDTIMEO: - if (get_udatamodel() == DATAMODEL_NATIVE) { + if (get_udatamodel() == DATAMODEL_NONE || + get_udatamodel() == DATAMODEL_NATIVE) { if (maxlen < sizeof (struct timeval)) { error = EINVAL; eprintsoline(so, error); @@ -5385,7 +5386,8 @@ val = drv_hztousec(so->so_sndtimeo); tmo_val.tv_sec = val / (1000 * 1000); tmo_val.tv_usec = val % (1000 * 1000); - if (get_udatamodel() == DATAMODEL_NATIVE) { + if (get_udatamodel() == DATAMODEL_NONE || + get_udatamodel() == DATAMODEL_NATIVE) { option = &tmo_val; len = sizeof (struct timeval); } else { @@ -5558,7 +5560,8 @@ break; case SO_SNDTIMEO: case SO_RCVTIMEO: - if (get_udatamodel() == DATAMODEL_NATIVE) { + if (get_udatamodel() == DATAMODEL_NONE || + get_udatamodel() == DATAMODEL_NATIVE) { if (optlen != sizeof (struct timeval)) { error = EINVAL; @@ -5615,7 +5618,8 @@ struct timeval tl; clock_t val; - if (get_udatamodel() == DATAMODEL_NATIVE) + if (get_udatamodel() == DATAMODEL_NONE || + get_udatamodel() == DATAMODEL_NATIVE) bcopy(&tl, (struct timeval *)optval, sizeof (struct timeval)); else @@ -5782,7 +5786,8 @@ break; case SO_SNDTIMEO: case SO_RCVTIMEO: - if (get_udatamodel() == DATAMODEL_NATIVE) { + if (get_udatamodel() == DATAMODEL_NONE || + get_udatamodel() == DATAMODEL_NATIVE) { if (optlen != sizeof (struct timeval)) { error = EINVAL; eprintsoline(so, error); @@ -5897,7 +5902,8 @@ struct timeval tl; clock_t val; - if (get_udatamodel() == DATAMODEL_NATIVE) + if (get_udatamodel() == DATAMODEL_NONE || + get_udatamodel() == DATAMODEL_NATIVE) bcopy(&tl, (struct timeval *)optval, sizeof (struct timeval)); else
--- a/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi_net.c Mon Jan 19 22:27:58 2009 -0800 +++ b/usr/src/uts/common/io/scsi/adapters/iscsi/iscsi_net.c Tue Jan 20 14:46:11 2009 +0800 @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * iSCSI Software Initiator @@ -415,14 +415,28 @@ int pflag; char msg[64]; size_t recv = 0; - struct timeval tl; ksocket_t ks = (ksocket_t)socket; - /* timeout is millisecond */ - tl.tv_sec = timeout / 1000; - tl.tv_usec = (timeout % 1000) * 1000; + + if (get_udatamodel() == DATAMODEL_NONE || + get_udatamodel() == DATAMODEL_NATIVE) { + struct timeval tl; - (void) ksocket_setsockopt(ks, SOL_SOCKET, SO_RCVTIMEO, &tl, - sizeof (struct timeval), CRED()); + /* timeout is millisecond */ + tl.tv_sec = timeout / 1000; + tl.tv_usec = (timeout % 1000) * 1000; + if (ksocket_setsockopt(ks, SOL_SOCKET, SO_RCVTIMEO, &tl, + sizeof (struct timeval), CRED())) + return (0); + } else { + struct timeval32 tl; + + /* timeout is millisecond */ + tl.tv_sec = timeout / 1000; + tl.tv_usec = (timeout % 1000) * 1000; + if (ksocket_setsockopt(ks, SOL_SOCKET, SO_RCVTIMEO, &tl, + sizeof (struct timeval32), CRED())) + return (0); + } pflag = MSG_ANY; bzero(msg, sizeof (msg)); @@ -454,15 +468,26 @@ int prflag = msg->msg_flags; ksocket_t ks = (ksocket_t)socket; size_t recv = 0; - struct timeval tl; - - tl.tv_sec = timeout; - tl.tv_usec = 0; /* Set recv timeout */ - if (ksocket_setsockopt(ks, SOL_SOCKET, SO_RCVTIMEO, &tl, - sizeof (struct timeval), CRED())) - return (0); + if (get_udatamodel() == DATAMODEL_NONE || + get_udatamodel() == DATAMODEL_NATIVE) { + struct timeval tl; + + tl.tv_sec = timeout; + tl.tv_usec = 0; + if (ksocket_setsockopt(ks, SOL_SOCKET, SO_RCVTIMEO, &tl, + sizeof (struct timeval), CRED())) + return (0); + } else { + struct timeval32 tl; + + tl.tv_sec = timeout; + tl.tv_usec = 0; + if (ksocket_setsockopt(ks, SOL_SOCKET, SO_RCVTIMEO, &tl, + sizeof (struct timeval32), CRED())) + return (0); + } /* * Receive the requested data. Block until all * data is received or timeout.