Index: kernel/scsi_transport_iscsi.c
===================================================================
--- kernel/scsi_transport_iscsi.c	(revision 479)
+++ kernel/scsi_transport_iscsi.c	(working copy)
@@ -31,8 +31,8 @@
 #include "scsi_transport_iscsi.h"
 #include "iscsi_if.h"
 
-#define ISCSI_SESSION_ATTRS 8
-#define ISCSI_CONN_ATTRS 6
+#define ISCSI_SESSION_ATTRS 9
+#define ISCSI_CONN_ATTRS 7
 
 struct iscsi_internal {
 	struct scsi_transport_template t;
@@ -424,9 +424,9 @@
 		goto remove_host;
 
 	*(unsigned long*)shost->hostdata = (unsigned long)session;
-	spin_lock_irqsave(sesslock, flags);
+	spin_lock_irqsave(&sesslock, flags);
 	list_add(&session->sess_list, &sesslist);
-	spin_unlock_irqrestore(sesslock, flags);
+	spin_unlock_irqrestore(&sesslock, flags);
 	return shost;
 
 remove_host:
@@ -452,9 +452,9 @@
 
 	scsi_remove_host(shost);
 	session = hostdata_session(shost->hostdata);
-	spin_lock_irqsave(sesslock, flags);
+	spin_lock_irqsave(&sesslock, flags);
 	list_del(&session->sess_list);
-	spin_unlock_irqrestore(sesslock, flags);
+	spin_unlock_irqrestore(&sesslock, flags);
 	iscsi_destroy_session(session);
 	/* ref from host alloc */
 	scsi_host_put(shost);
@@ -928,8 +928,8 @@
 }
 
 /* Get message from skb (based on rtnetlink_rcv_skb).  Each message is
- * processed by iscsi_if_recv_msg.  Malformed skbs with wrong length are
- * or invalid creds discarded silently.  */
+ * processed by iscsi_if_recv_msg.  Malformed skbs with wrong lengths or
+ * invalid creds are discarded silently.  */
 static void
 iscsi_if_rx(struct sock *sk, int len)
 {
@@ -1018,6 +1018,16 @@
 iscsi_conn_int_attr(ifmarker, ISCSI_PARAM_IFMARKER_EN, "%d");
 iscsi_conn_int_attr(ofmarker, ISCSI_PARAM_OFMARKER_EN, "%d");
 
+static ssize_t
+show_conn_handle(struct class_device *cdev, char *buf)
+{
+	struct iscsi_cls_conn *conn = iscsi_cdev_to_conn(cdev);
+
+	return snprintf(buf, 40, "%llu\n", iscsi_handle(conn));
+}
+static struct class_device_attribute 
+class_device_attr_conn_handle = __ATTR(handle,S_IRUGO,show_conn_handle,NULL);
+
 #define iscsi_cdev_to_session(_cdev) \
 	iscsi_dev_to_session(_cdev->dev)
 
@@ -1049,6 +1059,16 @@
 iscsi_session_int_attr(data_seq_in_order, ISCSI_PARAM_DATASEQ_INORDER_EN, "%d");
 iscsi_session_int_attr(erl, ISCSI_PARAM_ERL, "%d");
 
+static ssize_t
+show_session_handle(struct class_device *cdev, char *buf)
+{
+	struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev);
+
+	return snprintf(buf, 40, "%llu\n", iscsi_handle(session));
+}
+static struct class_device_attribute 
+class_device_attr_session_handle = __ATTR(handle,S_IRUGO,show_session_handle,NULL);
+
 #define SETUP_SESSION_RD_ATTR(field, param)				\
 	if (priv->param_mask & (1 << param)) {				\
 		priv->session_attrs[count] = &class_device_attr_##field;\
@@ -1163,6 +1183,7 @@
 	SETUP_CONN_RD_ATTR(data_digest, ISCSI_PARAM_DATADGST_EN);
 	SETUP_CONN_RD_ATTR(ifmarker, ISCSI_PARAM_IFMARKER_EN);
 	SETUP_CONN_RD_ATTR(ofmarker, ISCSI_PARAM_OFMARKER_EN);
+	SETUP_CONN_RD_ATTR(conn_handle, ISCSI_PARAM_CONN_HANDLE);
 
 	BUG_ON(count > ISCSI_CONN_ATTRS);
 	priv->conn_attrs[count] = NULL;
@@ -1182,6 +1203,7 @@
 	SETUP_SESSION_RD_ATTR(data_pdu_in_order, ISCSI_PARAM_PDU_INORDER_EN);
 	SETUP_SESSION_RD_ATTR(data_seq_in_order,ISCSI_PARAM_DATASEQ_INORDER_EN)
 	SETUP_SESSION_RD_ATTR(erl, ISCSI_PARAM_ERL);
+	SETUP_SESSION_RD_ATTR(session_handle, ISCSI_PARAM_SESSION_HANDLE);
 
 	BUG_ON(count > ISCSI_SESSION_ATTRS);
 	priv->session_attrs[count] = NULL;
Index: include/iscsi_if.h
===================================================================
--- include/iscsi_if.h	(revision 479)
+++ include/iscsi_if.h	(working copy)
@@ -160,8 +160,10 @@
 	ISCSI_PARAM_ERL			= 11,
 	ISCSI_PARAM_IFMARKER_EN		= 12,
 	ISCSI_PARAM_OFMARKER_EN		= 13,
+	ISCSI_PARAM_SESSION_HANDLE	= 14,
+	ISCSI_PARAM_CONN_HANDLE		= 15,
 };
-#define ISCSI_PARAM_MAX			14
+#define ISCSI_PARAM_MAX			16
 
 #define iscsi_ptr(_handle) ((void*)(unsigned long)_handle)
 #define iscsi_handle(_ptr) ((uint64_t)(unsigned long)_ptr)
Index: usr/ioctl.c
===================================================================
--- usr/ioctl.c	(revision 479)
+++ usr/ioctl.c	(working copy)
@@ -259,7 +259,7 @@
 		exit(-EIO);
 	}
 
-	log_debug(3, "send PDU finished for conn (handle %p)", iscsi_ptr(connh));
+	log_debug(3, "send PDU finished for conn (handle %llu)", connh);
 
 	xmitbuf = NULL;
 	return 0;
Index: usr/initiator.c
===================================================================
--- usr/initiator.c	(revision 479)
+++ usr/initiator.c	(working copy)
@@ -635,13 +635,13 @@
 	if (conn->state == STATE_LOGGED_IN) {
 		if (ipc->stop_conn(session->transport_handle, conn->handle,
 				      STOP_CONN_TERM)) {
-			log_error("can't stop connection 0x%p with "
-				  "id = %d (%d)", iscsi_ptr(conn->handle),
+			log_error("can't stop connection (handle %llu) with "
+				  "id = %d (%d)", (unsigned long long)conn->handle, 
 				  conn->id, errno);
 			return MGMT_IPC_ERR_INTERNAL;
 		}
-		log_debug(3, "connection 0x%p is stopped for termination",
-			iscsi_ptr(conn->handle));
+		log_debug(3, "connection (handle %llu) is stopped for termination",
+			  (unsigned long long)conn->handle);
 	}
 
 	iscsi_io_disconnect(conn);
@@ -861,6 +861,14 @@
 				.param = ISCSI_PARAM_OFMARKER_EN,
 				.value = &zero,/* FIXME: session->ofmarker_en */
 				.conn_only = 0,
+				}, {
+				.param = ISCSI_PARAM_SESSION_HANDLE,
+				.value = &zero,
+				.conn_only = 0,
+				}, {
+				.param = ISCSI_PARAM_CONN_HANDLE,
+				.value = &zero,
+				.conn_only = 0,
 				}
 
 				/*
@@ -921,10 +929,10 @@
 				conn->handle, &rc) || rc) {
 				__session_mgmt_ipc_login_cleanup(c->qtask,
 						MGMT_IPC_ERR_INTERNAL, 1);
-				log_error("can't start connection 0x%p with "
-					"id = %d, retcode %d (%d)",
-					iscsi_ptr(conn->handle), conn->id, rc,
-					errno);
+				log_error("can't start connection (handle %llu) with "
+					  "id = %d, retcode %d (%d)",
+					  (unsigned long long)conn->handle, conn->id, 
+					  rc, errno);
 				return;
 			}
 
@@ -1061,8 +1069,8 @@
 					goto cleanup;
 				}
 				log_debug(3, "created new iSCSI session, "
-					"handle 0x%p",
-					iscsi_ptr(session->handle));
+					  "handle %llu", 
+					  (unsigned long long)session->handle);
 
 				/* unique identifier for OUI */
 				if (__session_node_established(
@@ -1080,7 +1088,8 @@
 					goto s_cleanup;
 				}
 				log_debug(3, "created new iSCSI connection, "
-					"handle 0x%p", iscsi_ptr(conn->handle));
+					  "handle %llu", 
+					  (unsigned long long)conn->handle);
 			}
 
 			if (ipc->bind_conn(session->transport_handle,
@@ -1092,10 +1101,10 @@
 				err = MGMT_IPC_ERR_INTERNAL;
 				goto c_cleanup;
 			}
-			log_debug(3, "bound iSCSI connection (handle 0x%p) to "
-				  "session (handle 0x%p)",
-				  iscsi_ptr(conn->handle),
-				  iscsi_ptr(session->handle));
+			log_debug(3, "bound iSCSI connection (handle %llu) to "
+				  "session (handle %llu)", 
+				  (unsigned long long)conn->handle,
+				  (unsigned long long)session->handle);
 
 			conn->kernel_io = 1;
 			conn->send_pdu_begin = ipc->send_pdu_begin;
@@ -1176,13 +1185,14 @@
 		/* state: STATE_CLEANUP_WAIT */
 		if (ipc->stop_conn(session->transport_handle, conn->handle,
 				      STOP_CONN_RECOVER)) {
-			log_error("can't stop connection 0x%p with "
-				  "id = %d (%d)", iscsi_ptr(conn->handle),
-				  conn->id, errno);
+			log_error("can't stop connection (handle %llu) with "
+				  "id = %d (%d)", 
+				  (unsigned long long)conn->handle, conn->id, 
+				  errno);
 			return -1;
 		}
-		log_debug(3, "connection 0x%p is stopped for recovery",
-			iscsi_ptr(conn->handle));
+		log_debug(3, "connection (handle %llu) is stopped for recovery",
+			  (unsigned long long)conn->handle);
 		iscsi_io_disconnect(conn);
 		__session_conn_queue_flush(conn);
 	}
@@ -1328,13 +1338,15 @@
 	} else {
 		if (ipc->stop_conn(session->transport_handle, conn->handle,
 				      STOP_CONN_TERM)) {
-			log_error("can't stop connection 0x%p with "
-				  "id = %d (%d)", iscsi_ptr(conn->handle),
-				  conn->id, errno);
+			log_error("can't stop connection (handle %llu) with "
+				  "id = %d (%d)", 
+				  (unsigned long long)conn->handle, conn->id, 
+				  errno);
 			return;
 		}
-		log_debug(3, "connection 0x%p is stopped for termination",
-			iscsi_ptr(conn->handle));
+		log_debug(3, 
+			  "connection (handle %llu) is stopped for termination",
+			  (unsigned long long)conn->handle);
 		iscsi_io_disconnect(conn);
 		__session_conn_queue_flush(conn);
 	}
@@ -1350,8 +1362,9 @@
 	iscsi_conn_t *conn = item->context;
 	iscsi_session_t *session = conn->session;
 
-	log_warning("detected iSCSI connection (handle %p) error (%d) "
-		"state (%d)", iscsi_ptr(conn->handle), error, conn->state);
+	log_warning("detected iSCSI connection (handle %llu) error (%d) "
+		    "state (%d)", (unsigned long long)conn->handle, error, 
+		    conn->state);
 	__conn_error_handle(session, conn);
 
 }
Index: usr/netlink.c
===================================================================
--- usr/netlink.c	(revision 479)
+++ usr/netlink.c	(working copy)
@@ -485,7 +485,8 @@
 		exit(-EIO);
 	}
 
-	log_debug(3, "send PDU finished for conn (handle %p)", iscsi_ptr(connh));
+	log_debug(3, "send PDU finished for conn (handle %llu)", 
+		  (unsigned long long)connh);
 
 	xmitbuf = NULL;
 	return 0;
