aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/libiscsi.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2008-01-31 14:36:52 -0500
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-02-07 19:02:37 -0500
commit322d739da83bbff0309c202181f79c08d9534880 (patch)
tree4bbe485dc4f942ac6d5c8ad1c4508599a1eb2c66 /drivers/scsi/libiscsi.c
parentc238c3bba9b422a9b453c75e157b416204f22a71 (diff)
[SCSI] iscsi: fix up iscsi printk prefix
Some iscsi class messages have the dev_printk prefix and some libiscsi and iscsi_tcp messages have "iscsi" or the module name as a prefix which is normally pretty useless when trying to figure out which session or connection the message is attached to. This patch adds iscsi lib and class dev_printks so all messages have a common prefix that can be used to figure out which object printed it. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/libiscsi.c')
-rw-r--r--drivers/scsi/libiscsi.c76
1 files changed, 43 insertions, 33 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index b2a1ec8725b8..10ba76285852 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -416,8 +416,9 @@ static void iscsi_scsi_cmd_rsp(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
416 416
417 if (datalen < 2) { 417 if (datalen < 2) {
418invalid_datalen: 418invalid_datalen:
419 printk(KERN_ERR "iscsi: Got CHECK_CONDITION but " 419 iscsi_conn_printk(KERN_ERR, conn,
420 "invalid data buffer size of %d\n", datalen); 420 "Got CHECK_CONDITION but invalid data "
421 "buffer size of %d\n", datalen);
421 sc->result = DID_BAD_TARGET << 16; 422 sc->result = DID_BAD_TARGET << 16;
422 goto out; 423 goto out;
423 } 424 }
@@ -494,7 +495,7 @@ static void iscsi_send_nopout(struct iscsi_conn *conn, struct iscsi_nopin *rhdr)
494 495
495 mtask = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0); 496 mtask = __iscsi_conn_send_pdu(conn, (struct iscsi_hdr *)&hdr, NULL, 0);
496 if (!mtask) { 497 if (!mtask) {
497 printk(KERN_ERR "Could not send nopout\n"); 498 iscsi_conn_printk(KERN_ERR, conn, "Could not send nopout\n");
498 return; 499 return;
499 } 500 }
500 501
@@ -522,9 +523,10 @@ static int iscsi_handle_reject(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
522 if (ntoh24(reject->dlength) >= sizeof(struct iscsi_hdr)) { 523 if (ntoh24(reject->dlength) >= sizeof(struct iscsi_hdr)) {
523 memcpy(&rejected_pdu, data, sizeof(struct iscsi_hdr)); 524 memcpy(&rejected_pdu, data, sizeof(struct iscsi_hdr));
524 itt = get_itt(rejected_pdu.itt); 525 itt = get_itt(rejected_pdu.itt);
525 printk(KERN_ERR "itt 0x%x had pdu (op 0x%x) rejected " 526 iscsi_conn_printk(KERN_ERR, conn,
526 "due to DataDigest error.\n", itt, 527 "itt 0x%x had pdu (op 0x%x) rejected "
527 rejected_pdu.opcode); 528 "due to DataDigest error.\n", itt,
529 rejected_pdu.opcode);
528 } 530 }
529 } 531 }
530 return 0; 532 return 0;
@@ -696,16 +698,19 @@ int iscsi_verify_itt(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
696 if (hdr->itt != RESERVED_ITT) { 698 if (hdr->itt != RESERVED_ITT) {
697 if (((__force u32)hdr->itt & ISCSI_AGE_MASK) != 699 if (((__force u32)hdr->itt & ISCSI_AGE_MASK) !=
698 (session->age << ISCSI_AGE_SHIFT)) { 700 (session->age << ISCSI_AGE_SHIFT)) {
699 printk(KERN_ERR "iscsi: received itt %x expected " 701 iscsi_conn_printk(KERN_ERR, conn,
700 "session age (%x)\n", (__force u32)hdr->itt, 702 "received itt %x expected session "
701 session->age & ISCSI_AGE_MASK); 703 "age (%x)\n", (__force u32)hdr->itt,
704 session->age & ISCSI_AGE_MASK);
702 return ISCSI_ERR_BAD_ITT; 705 return ISCSI_ERR_BAD_ITT;
703 } 706 }
704 707
705 if (((__force u32)hdr->itt & ISCSI_CID_MASK) != 708 if (((__force u32)hdr->itt & ISCSI_CID_MASK) !=
706 (conn->id << ISCSI_CID_SHIFT)) { 709 (conn->id << ISCSI_CID_SHIFT)) {
707 printk(KERN_ERR "iscsi: received itt %x, expected " 710 iscsi_conn_printk(KERN_ERR, conn,
708 "CID (%x)\n", (__force u32)hdr->itt, conn->id); 711 "iscsi: received itt %x, expected "
712 "CID (%x)\n",
713 (__force u32)hdr->itt, conn->id);
709 return ISCSI_ERR_BAD_ITT; 714 return ISCSI_ERR_BAD_ITT;
710 } 715 }
711 itt = get_itt(hdr->itt); 716 itt = get_itt(hdr->itt);
@@ -716,16 +721,17 @@ int iscsi_verify_itt(struct iscsi_conn *conn, struct iscsi_hdr *hdr,
716 ctask = session->cmds[itt]; 721 ctask = session->cmds[itt];
717 722
718 if (!ctask->sc) { 723 if (!ctask->sc) {
719 printk(KERN_INFO "iscsi: dropping ctask with " 724 iscsi_conn_printk(KERN_INFO, conn, "dropping ctask "
720 "itt 0x%x\n", ctask->itt); 725 "with itt 0x%x\n", ctask->itt);
721 /* force drop */ 726 /* force drop */
722 return ISCSI_ERR_NO_SCSI_CMD; 727 return ISCSI_ERR_NO_SCSI_CMD;
723 } 728 }
724 729
725 if (ctask->sc->SCp.phase != session->age) { 730 if (ctask->sc->SCp.phase != session->age) {
726 printk(KERN_ERR "iscsi: ctask's session age %d, " 731 iscsi_conn_printk(KERN_ERR, conn,
727 "expected %d\n", ctask->sc->SCp.phase, 732 "iscsi: ctask's session age %d, "
728 session->age); 733 "expected %d\n", ctask->sc->SCp.phase,
734 session->age);
729 return ISCSI_ERR_SESSION_FAILED; 735 return ISCSI_ERR_SESSION_FAILED;
730 } 736 }
731 } 737 }
@@ -1170,7 +1176,8 @@ failed:
1170 mutex_lock(&session->eh_mutex); 1176 mutex_lock(&session->eh_mutex);
1171 spin_lock_bh(&session->lock); 1177 spin_lock_bh(&session->lock);
1172 if (session->state == ISCSI_STATE_LOGGED_IN) 1178 if (session->state == ISCSI_STATE_LOGGED_IN)
1173 printk(KERN_INFO "iscsi: host reset succeeded\n"); 1179 iscsi_session_printk(KERN_INFO, session,
1180 "host reset succeeded\n");
1174 else 1181 else
1175 goto failed; 1182 goto failed;
1176 spin_unlock_bh(&session->lock); 1183 spin_unlock_bh(&session->lock);
@@ -1368,10 +1375,10 @@ static void iscsi_check_transport_timeouts(unsigned long data)
1368 last_recv = conn->last_recv; 1375 last_recv = conn->last_recv;
1369 if (time_before_eq(last_recv + timeout + (conn->ping_timeout * HZ), 1376 if (time_before_eq(last_recv + timeout + (conn->ping_timeout * HZ),
1370 jiffies)) { 1377 jiffies)) {
1371 printk(KERN_ERR "ping timeout of %d secs expired, " 1378 iscsi_conn_printk(KERN_ERR, conn, "ping timeout of %d secs "
1372 "last rx %lu, last ping %lu, now %lu\n", 1379 "expired, last rx %lu, last ping %lu, "
1373 conn->ping_timeout, last_recv, 1380 "now %lu\n", conn->ping_timeout, last_recv,
1374 conn->last_ping, jiffies); 1381 conn->last_ping, jiffies);
1375 spin_unlock(&session->lock); 1382 spin_unlock(&session->lock);
1376 iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED); 1383 iscsi_conn_failure(conn, ISCSI_ERR_CONN_FAILED);
1377 return; 1384 return;
@@ -1952,9 +1959,10 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
1952 } 1959 }
1953 spin_unlock_irqrestore(session->host->host_lock, flags); 1960 spin_unlock_irqrestore(session->host->host_lock, flags);
1954 msleep_interruptible(500); 1961 msleep_interruptible(500);
1955 printk(KERN_INFO "iscsi: scsi conn_destroy(): host_busy %d " 1962 iscsi_conn_printk(KERN_INFO, conn, "iscsi conn_destroy(): "
1956 "host_failed %d\n", session->host->host_busy, 1963 "host_busy %d host_failed %d\n",
1957 session->host->host_failed); 1964 session->host->host_busy,
1965 session->host->host_failed);
1958 /* 1966 /*
1959 * force eh_abort() to unblock 1967 * force eh_abort() to unblock
1960 */ 1968 */
@@ -1983,27 +1991,28 @@ int iscsi_conn_start(struct iscsi_cls_conn *cls_conn)
1983 struct iscsi_session *session = conn->session; 1991 struct iscsi_session *session = conn->session;
1984 1992
1985 if (!session) { 1993 if (!session) {
1986 printk(KERN_ERR "iscsi: can't start unbound connection\n"); 1994 iscsi_conn_printk(KERN_ERR, conn,
1995 "can't start unbound connection\n");
1987 return -EPERM; 1996 return -EPERM;
1988 } 1997 }
1989 1998
1990 if ((session->imm_data_en || !session->initial_r2t_en) && 1999 if ((session->imm_data_en || !session->initial_r2t_en) &&
1991 session->first_burst > session->max_burst) { 2000 session->first_burst > session->max_burst) {
1992 printk("iscsi: invalid burst lengths: " 2001 iscsi_conn_printk(KERN_INFO, conn, "invalid burst lengths: "
1993 "first_burst %d max_burst %d\n", 2002 "first_burst %d max_burst %d\n",
1994 session->first_burst, session->max_burst); 2003 session->first_burst, session->max_burst);
1995 return -EINVAL; 2004 return -EINVAL;
1996 } 2005 }
1997 2006
1998 if (conn->ping_timeout && !conn->recv_timeout) { 2007 if (conn->ping_timeout && !conn->recv_timeout) {
1999 printk(KERN_ERR "iscsi: invalid recv timeout of zero " 2008 iscsi_conn_printk(KERN_ERR, conn, "invalid recv timeout of "
2000 "Using 5 seconds\n."); 2009 "zero. Using 5 seconds\n.");
2001 conn->recv_timeout = 5; 2010 conn->recv_timeout = 5;
2002 } 2011 }
2003 2012
2004 if (conn->recv_timeout && !conn->ping_timeout) { 2013 if (conn->recv_timeout && !conn->ping_timeout) {
2005 printk(KERN_ERR "iscsi: invalid ping timeout of zero " 2014 iscsi_conn_printk(KERN_ERR, conn, "invalid ping timeout of "
2006 "Using 5 seconds.\n"); 2015 "zero. Using 5 seconds.\n");
2007 conn->ping_timeout = 5; 2016 conn->ping_timeout = 5;
2008 } 2017 }
2009 2018
@@ -2147,7 +2156,8 @@ void iscsi_conn_stop(struct iscsi_cls_conn *cls_conn, int flag)
2147 iscsi_start_session_recovery(session, conn, flag); 2156 iscsi_start_session_recovery(session, conn, flag);
2148 break; 2157 break;
2149 default: 2158 default:
2150 printk(KERN_ERR "iscsi: invalid stop flag %d\n", flag); 2159 iscsi_conn_printk(KERN_ERR, conn,
2160 "invalid stop flag %d\n", flag);
2151 } 2161 }
2152} 2162}
2153EXPORT_SYMBOL_GPL(iscsi_conn_stop); 2163EXPORT_SYMBOL_GPL(iscsi_conn_stop);