diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2008-01-31 14:36:52 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-02-07 19:02:37 -0500 |
commit | 322d739da83bbff0309c202181f79c08d9534880 (patch) | |
tree | 4bbe485dc4f942ac6d5c8ad1c4508599a1eb2c66 /drivers/scsi | |
parent | c238c3bba9b422a9b453c75e157b416204f22a71 (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')
-rw-r--r-- | drivers/scsi/iscsi_tcp.c | 57 | ||||
-rw-r--r-- | drivers/scsi/libiscsi.c | 76 | ||||
-rw-r--r-- | drivers/scsi/scsi_transport_iscsi.c | 56 |
3 files changed, 103 insertions, 86 deletions
diff --git a/drivers/scsi/iscsi_tcp.c b/drivers/scsi/iscsi_tcp.c index b6f99dfbb038..8a178674cb18 100644 --- a/drivers/scsi/iscsi_tcp.c +++ b/drivers/scsi/iscsi_tcp.c | |||
@@ -629,8 +629,9 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
629 | int rc; | 629 | int rc; |
630 | 630 | ||
631 | if (tcp_conn->in.datalen) { | 631 | if (tcp_conn->in.datalen) { |
632 | printk(KERN_ERR "iscsi_tcp: invalid R2t with datalen %d\n", | 632 | iscsi_conn_printk(KERN_ERR, conn, |
633 | tcp_conn->in.datalen); | 633 | "invalid R2t with datalen %d\n", |
634 | tcp_conn->in.datalen); | ||
634 | return ISCSI_ERR_DATALEN; | 635 | return ISCSI_ERR_DATALEN; |
635 | } | 636 | } |
636 | 637 | ||
@@ -644,8 +645,9 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
644 | iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr); | 645 | iscsi_update_cmdsn(session, (struct iscsi_nopin*)rhdr); |
645 | 646 | ||
646 | if (!ctask->sc || session->state != ISCSI_STATE_LOGGED_IN) { | 647 | if (!ctask->sc || session->state != ISCSI_STATE_LOGGED_IN) { |
647 | printk(KERN_INFO "iscsi_tcp: dropping R2T itt %d in " | 648 | iscsi_conn_printk(KERN_INFO, conn, |
648 | "recovery...\n", ctask->itt); | 649 | "dropping R2T itt %d in recovery.\n", |
650 | ctask->itt); | ||
649 | return 0; | 651 | return 0; |
650 | } | 652 | } |
651 | 653 | ||
@@ -655,7 +657,8 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
655 | r2t->exp_statsn = rhdr->statsn; | 657 | r2t->exp_statsn = rhdr->statsn; |
656 | r2t->data_length = be32_to_cpu(rhdr->data_length); | 658 | r2t->data_length = be32_to_cpu(rhdr->data_length); |
657 | if (r2t->data_length == 0) { | 659 | if (r2t->data_length == 0) { |
658 | printk(KERN_ERR "iscsi_tcp: invalid R2T with zero data len\n"); | 660 | iscsi_conn_printk(KERN_ERR, conn, |
661 | "invalid R2T with zero data len\n"); | ||
659 | __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, | 662 | __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, |
660 | sizeof(void*)); | 663 | sizeof(void*)); |
661 | return ISCSI_ERR_DATALEN; | 664 | return ISCSI_ERR_DATALEN; |
@@ -668,9 +671,10 @@ iscsi_r2t_rsp(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask) | |||
668 | 671 | ||
669 | r2t->data_offset = be32_to_cpu(rhdr->data_offset); | 672 | r2t->data_offset = be32_to_cpu(rhdr->data_offset); |
670 | if (r2t->data_offset + r2t->data_length > scsi_bufflen(ctask->sc)) { | 673 | if (r2t->data_offset + r2t->data_length > scsi_bufflen(ctask->sc)) { |
671 | printk(KERN_ERR "iscsi_tcp: invalid R2T with data len %u at " | 674 | iscsi_conn_printk(KERN_ERR, conn, |
672 | "offset %u and total length %d\n", r2t->data_length, | 675 | "invalid R2T with data len %u at offset %u " |
673 | r2t->data_offset, scsi_bufflen(ctask->sc)); | 676 | "and total length %d\n", r2t->data_length, |
677 | r2t->data_offset, scsi_bufflen(ctask->sc)); | ||
674 | __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, | 678 | __kfifo_put(tcp_ctask->r2tpool.queue, (void*)&r2t, |
675 | sizeof(void*)); | 679 | sizeof(void*)); |
676 | return ISCSI_ERR_DATALEN; | 680 | return ISCSI_ERR_DATALEN; |
@@ -736,8 +740,9 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) | |||
736 | /* verify PDU length */ | 740 | /* verify PDU length */ |
737 | tcp_conn->in.datalen = ntoh24(hdr->dlength); | 741 | tcp_conn->in.datalen = ntoh24(hdr->dlength); |
738 | if (tcp_conn->in.datalen > conn->max_recv_dlength) { | 742 | if (tcp_conn->in.datalen > conn->max_recv_dlength) { |
739 | printk(KERN_ERR "iscsi_tcp: datalen %d > %d\n", | 743 | iscsi_conn_printk(KERN_ERR, conn, |
740 | tcp_conn->in.datalen, conn->max_recv_dlength); | 744 | "iscsi_tcp: datalen %d > %d\n", |
745 | tcp_conn->in.datalen, conn->max_recv_dlength); | ||
741 | return ISCSI_ERR_DATALEN; | 746 | return ISCSI_ERR_DATALEN; |
742 | } | 747 | } |
743 | 748 | ||
@@ -819,10 +824,12 @@ iscsi_tcp_hdr_dissect(struct iscsi_conn *conn, struct iscsi_hdr *hdr) | |||
819 | * For now we fail until we find a vendor that needs it | 824 | * For now we fail until we find a vendor that needs it |
820 | */ | 825 | */ |
821 | if (ISCSI_DEF_MAX_RECV_SEG_LEN < tcp_conn->in.datalen) { | 826 | if (ISCSI_DEF_MAX_RECV_SEG_LEN < tcp_conn->in.datalen) { |
822 | printk(KERN_ERR "iscsi_tcp: received buffer of len %u " | 827 | iscsi_conn_printk(KERN_ERR, conn, |
823 | "but conn buffer is only %u (opcode %0x)\n", | 828 | "iscsi_tcp: received buffer of " |
824 | tcp_conn->in.datalen, | 829 | "len %u but conn buffer is only %u " |
825 | ISCSI_DEF_MAX_RECV_SEG_LEN, opcode); | 830 | "(opcode %0x)\n", |
831 | tcp_conn->in.datalen, | ||
832 | ISCSI_DEF_MAX_RECV_SEG_LEN, opcode); | ||
826 | rc = ISCSI_ERR_PROTO; | 833 | rc = ISCSI_ERR_PROTO; |
827 | break; | 834 | break; |
828 | } | 835 | } |
@@ -1496,30 +1503,25 @@ iscsi_tcp_conn_create(struct iscsi_cls_session *cls_session, uint32_t conn_idx) | |||
1496 | tcp_conn->tx_hash.tfm = crypto_alloc_hash("crc32c", 0, | 1503 | tcp_conn->tx_hash.tfm = crypto_alloc_hash("crc32c", 0, |
1497 | CRYPTO_ALG_ASYNC); | 1504 | CRYPTO_ALG_ASYNC); |
1498 | tcp_conn->tx_hash.flags = 0; | 1505 | tcp_conn->tx_hash.flags = 0; |
1499 | if (IS_ERR(tcp_conn->tx_hash.tfm)) { | 1506 | if (IS_ERR(tcp_conn->tx_hash.tfm)) |
1500 | printk(KERN_ERR "Could not create connection due to crc32c " | ||
1501 | "loading error %ld. Make sure the crc32c module is " | ||
1502 | "built as a module or into the kernel\n", | ||
1503 | PTR_ERR(tcp_conn->tx_hash.tfm)); | ||
1504 | goto free_tcp_conn; | 1507 | goto free_tcp_conn; |
1505 | } | ||
1506 | 1508 | ||
1507 | tcp_conn->rx_hash.tfm = crypto_alloc_hash("crc32c", 0, | 1509 | tcp_conn->rx_hash.tfm = crypto_alloc_hash("crc32c", 0, |
1508 | CRYPTO_ALG_ASYNC); | 1510 | CRYPTO_ALG_ASYNC); |
1509 | tcp_conn->rx_hash.flags = 0; | 1511 | tcp_conn->rx_hash.flags = 0; |
1510 | if (IS_ERR(tcp_conn->rx_hash.tfm)) { | 1512 | if (IS_ERR(tcp_conn->rx_hash.tfm)) |
1511 | printk(KERN_ERR "Could not create connection due to crc32c " | ||
1512 | "loading error %ld. Make sure the crc32c module is " | ||
1513 | "built as a module or into the kernel\n", | ||
1514 | PTR_ERR(tcp_conn->rx_hash.tfm)); | ||
1515 | goto free_tx_tfm; | 1513 | goto free_tx_tfm; |
1516 | } | ||
1517 | 1514 | ||
1518 | return cls_conn; | 1515 | return cls_conn; |
1519 | 1516 | ||
1520 | free_tx_tfm: | 1517 | free_tx_tfm: |
1521 | crypto_free_hash(tcp_conn->tx_hash.tfm); | 1518 | crypto_free_hash(tcp_conn->tx_hash.tfm); |
1522 | free_tcp_conn: | 1519 | free_tcp_conn: |
1520 | iscsi_conn_printk(KERN_ERR, conn, | ||
1521 | "Could not create connection due to crc32c " | ||
1522 | "loading error. Make sure the crc32c " | ||
1523 | "module is built as a module or into the " | ||
1524 | "kernel\n"); | ||
1523 | kfree(tcp_conn); | 1525 | kfree(tcp_conn); |
1524 | tcp_conn_alloc_fail: | 1526 | tcp_conn_alloc_fail: |
1525 | iscsi_conn_teardown(cls_conn); | 1527 | iscsi_conn_teardown(cls_conn); |
@@ -1627,7 +1629,8 @@ iscsi_tcp_conn_bind(struct iscsi_cls_session *cls_session, | |||
1627 | /* lookup for existing socket */ | 1629 | /* lookup for existing socket */ |
1628 | sock = sockfd_lookup((int)transport_eph, &err); | 1630 | sock = sockfd_lookup((int)transport_eph, &err); |
1629 | if (!sock) { | 1631 | if (!sock) { |
1630 | printk(KERN_ERR "iscsi_tcp: sockfd_lookup failed %d\n", err); | 1632 | iscsi_conn_printk(KERN_ERR, conn, |
1633 | "sockfd_lookup failed %d\n", err); | ||
1631 | return -EEXIST; | 1634 | return -EEXIST; |
1632 | } | 1635 | } |
1633 | /* | 1636 | /* |
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) { |
418 | invalid_datalen: | 418 | invalid_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 | } |
2153 | EXPORT_SYMBOL_GPL(iscsi_conn_stop); | 2163 | EXPORT_SYMBOL_GPL(iscsi_conn_stop); |
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c index 35834bf4ba86..8e73ff02fb74 100644 --- a/drivers/scsi/scsi_transport_iscsi.c +++ b/drivers/scsi/scsi_transport_iscsi.c | |||
@@ -350,8 +350,9 @@ static void session_recovery_timedout(struct work_struct *work) | |||
350 | recovery_work.work); | 350 | recovery_work.work); |
351 | unsigned long flags; | 351 | unsigned long flags; |
352 | 352 | ||
353 | dev_printk(KERN_INFO, &session->dev, "iscsi: session recovery timed " | 353 | iscsi_cls_session_printk(KERN_INFO, session, |
354 | "out after %d secs\n", session->recovery_tmo); | 354 | "session recovery timed out after %d secs\n", |
355 | session->recovery_tmo); | ||
355 | 356 | ||
356 | spin_lock_irqsave(&session->lock, flags); | 357 | spin_lock_irqsave(&session->lock, flags); |
357 | switch (session->state) { | 358 | switch (session->state) { |
@@ -492,8 +493,8 @@ int iscsi_add_session(struct iscsi_cls_session *session, unsigned int target_id) | |||
492 | session->sid); | 493 | session->sid); |
493 | err = device_add(&session->dev); | 494 | err = device_add(&session->dev); |
494 | if (err) { | 495 | if (err) { |
495 | dev_printk(KERN_ERR, &session->dev, "iscsi: could not " | 496 | iscsi_cls_session_printk(KERN_ERR, session, |
496 | "register session's dev\n"); | 497 | "could not register session's dev\n"); |
497 | goto release_host; | 498 | goto release_host; |
498 | } | 499 | } |
499 | transport_register_device(&session->dev); | 500 | transport_register_device(&session->dev); |
@@ -597,8 +598,9 @@ void iscsi_remove_session(struct iscsi_cls_session *session) | |||
597 | err = device_for_each_child(&session->dev, NULL, | 598 | err = device_for_each_child(&session->dev, NULL, |
598 | iscsi_iter_destroy_conn_fn); | 599 | iscsi_iter_destroy_conn_fn); |
599 | if (err) | 600 | if (err) |
600 | dev_printk(KERN_ERR, &session->dev, "iscsi: Could not delete " | 601 | iscsi_cls_session_printk(KERN_ERR, session, |
601 | "all connections for session. Error %d.\n", err); | 602 | "Could not delete all connections " |
603 | "for session. Error %d.\n", err); | ||
602 | 604 | ||
603 | transport_unregister_device(&session->dev); | 605 | transport_unregister_device(&session->dev); |
604 | device_del(&session->dev); | 606 | device_del(&session->dev); |
@@ -670,8 +672,8 @@ iscsi_create_conn(struct iscsi_cls_session *session, uint32_t cid) | |||
670 | conn->dev.release = iscsi_conn_release; | 672 | conn->dev.release = iscsi_conn_release; |
671 | err = device_register(&conn->dev); | 673 | err = device_register(&conn->dev); |
672 | if (err) { | 674 | if (err) { |
673 | dev_printk(KERN_ERR, &conn->dev, "iscsi: could not register " | 675 | iscsi_cls_session_printk(KERN_ERR, session, "could not " |
674 | "connection's dev\n"); | 676 | "register connection's dev\n"); |
675 | goto release_parent_ref; | 677 | goto release_parent_ref; |
676 | } | 678 | } |
677 | transport_register_device(&conn->dev); | 679 | transport_register_device(&conn->dev); |
@@ -778,8 +780,8 @@ int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr, | |||
778 | skb = alloc_skb(len, GFP_ATOMIC); | 780 | skb = alloc_skb(len, GFP_ATOMIC); |
779 | if (!skb) { | 781 | if (!skb) { |
780 | iscsi_conn_error(conn, ISCSI_ERR_CONN_FAILED); | 782 | iscsi_conn_error(conn, ISCSI_ERR_CONN_FAILED); |
781 | dev_printk(KERN_ERR, &conn->dev, "iscsi: can not deliver " | 783 | iscsi_cls_conn_printk(KERN_ERR, conn, "can not deliver " |
782 | "control PDU: OOM\n"); | 784 | "control PDU: OOM\n"); |
783 | return -ENOMEM; | 785 | return -ENOMEM; |
784 | } | 786 | } |
785 | 787 | ||
@@ -819,8 +821,8 @@ void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error) | |||
819 | 821 | ||
820 | skb = alloc_skb(len, GFP_ATOMIC); | 822 | skb = alloc_skb(len, GFP_ATOMIC); |
821 | if (!skb) { | 823 | if (!skb) { |
822 | dev_printk(KERN_ERR, &conn->dev, "iscsi: gracefully ignored " | 824 | iscsi_cls_conn_printk(KERN_ERR, conn, "gracefully ignored " |
823 | "conn error (%d)\n", error); | 825 | "conn error (%d)\n", error); |
824 | return; | 826 | return; |
825 | } | 827 | } |
826 | 828 | ||
@@ -834,8 +836,8 @@ void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error) | |||
834 | 836 | ||
835 | iscsi_broadcast_skb(skb, GFP_ATOMIC); | 837 | iscsi_broadcast_skb(skb, GFP_ATOMIC); |
836 | 838 | ||
837 | dev_printk(KERN_INFO, &conn->dev, "iscsi: detected conn error (%d)\n", | 839 | iscsi_cls_conn_printk(KERN_INFO, conn, "detected conn error (%d)\n", |
838 | error); | 840 | error); |
839 | } | 841 | } |
840 | EXPORT_SYMBOL_GPL(iscsi_conn_error); | 842 | EXPORT_SYMBOL_GPL(iscsi_conn_error); |
841 | 843 | ||
@@ -890,8 +892,8 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh) | |||
890 | 892 | ||
891 | skbstat = alloc_skb(len, GFP_ATOMIC); | 893 | skbstat = alloc_skb(len, GFP_ATOMIC); |
892 | if (!skbstat) { | 894 | if (!skbstat) { |
893 | dev_printk(KERN_ERR, &conn->dev, "iscsi: can not " | 895 | iscsi_cls_conn_printk(KERN_ERR, conn, "can not " |
894 | "deliver stats: OOM\n"); | 896 | "deliver stats: OOM\n"); |
895 | return -ENOMEM; | 897 | return -ENOMEM; |
896 | } | 898 | } |
897 | 899 | ||
@@ -947,8 +949,9 @@ int iscsi_session_event(struct iscsi_cls_session *session, | |||
947 | 949 | ||
948 | skb = alloc_skb(len, GFP_KERNEL); | 950 | skb = alloc_skb(len, GFP_KERNEL); |
949 | if (!skb) { | 951 | if (!skb) { |
950 | dev_printk(KERN_ERR, &session->dev, "Cannot notify userspace " | 952 | iscsi_cls_session_printk(KERN_ERR, session, |
951 | "of session event %u\n", event); | 953 | "Cannot notify userspace of session " |
954 | "event %u\n", event); | ||
952 | return -ENOMEM; | 955 | return -ENOMEM; |
953 | } | 956 | } |
954 | 957 | ||
@@ -971,8 +974,8 @@ int iscsi_session_event(struct iscsi_cls_session *session, | |||
971 | ev->r.unbind_session.sid = session->sid; | 974 | ev->r.unbind_session.sid = session->sid; |
972 | break; | 975 | break; |
973 | default: | 976 | default: |
974 | dev_printk(KERN_ERR, &session->dev, "Invalid event %u.\n", | 977 | iscsi_cls_session_printk(KERN_ERR, session, "Invalid event " |
975 | event); | 978 | "%u.\n", event); |
976 | kfree_skb(skb); | 979 | kfree_skb(skb); |
977 | return -EINVAL; | 980 | return -EINVAL; |
978 | } | 981 | } |
@@ -983,8 +986,10 @@ int iscsi_session_event(struct iscsi_cls_session *session, | |||
983 | */ | 986 | */ |
984 | rc = iscsi_broadcast_skb(skb, GFP_KERNEL); | 987 | rc = iscsi_broadcast_skb(skb, GFP_KERNEL); |
985 | if (rc < 0) | 988 | if (rc < 0) |
986 | dev_printk(KERN_ERR, &session->dev, "Cannot notify userspace " | 989 | iscsi_cls_session_printk(KERN_ERR, session, |
987 | "of session event %u. Check iscsi daemon\n", event); | 990 | "Cannot notify userspace of session " |
991 | "event %u. Check iscsi daemon\n", | ||
992 | event); | ||
988 | return rc; | 993 | return rc; |
989 | } | 994 | } |
990 | EXPORT_SYMBOL_GPL(iscsi_session_event); | 995 | EXPORT_SYMBOL_GPL(iscsi_session_event); |
@@ -1017,16 +1022,15 @@ iscsi_if_create_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev) | |||
1017 | 1022 | ||
1018 | session = iscsi_session_lookup(ev->u.c_conn.sid); | 1023 | session = iscsi_session_lookup(ev->u.c_conn.sid); |
1019 | if (!session) { | 1024 | if (!session) { |
1020 | printk(KERN_ERR "iscsi: invalid session %d\n", | 1025 | printk(KERN_ERR "iscsi: invalid session %d.\n", |
1021 | ev->u.c_conn.sid); | 1026 | ev->u.c_conn.sid); |
1022 | return -EINVAL; | 1027 | return -EINVAL; |
1023 | } | 1028 | } |
1024 | 1029 | ||
1025 | conn = transport->create_conn(session, ev->u.c_conn.cid); | 1030 | conn = transport->create_conn(session, ev->u.c_conn.cid); |
1026 | if (!conn) { | 1031 | if (!conn) { |
1027 | printk(KERN_ERR "iscsi: couldn't create a new " | 1032 | iscsi_cls_session_printk(KERN_ERR, session, |
1028 | "connection for session %d\n", | 1033 | "couldn't create a new connection."); |
1029 | session->sid); | ||
1030 | return -ENOMEM; | 1034 | return -ENOMEM; |
1031 | } | 1035 | } |
1032 | 1036 | ||