aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_transport_iscsi.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2006-02-01 22:06:49 -0500
committer <jejb@mulgrave.il.steeleye.com>2006-02-04 17:17:03 -0500
commit7b7232f3fb5ecd7c30cb52df368070cc5f5ca614 (patch)
treec7430280a69e587575bba336259e11a7aec8674e /drivers/scsi/scsi_transport_iscsi.c
parentbb08f92ebd75704e07d69bb9d8ee234d1a500b98 (diff)
[SCSI] iscsi update: cleanup iscsi class interface
From: michaelc@cs.wisc.edu fujita.tomonori@lab.ntt.co.jp da-x@monatomic.org and err path fixup from: ogerlitz@voltaire.com This patch cleans up that interface by having the lld and class pass a iscsi_cls_session or iscsi_cls_conn between each other when the function is used by HW and SW iscsi llds. This way the lld does not have to remember if it has to send a handle or pointer and a handle or pointer to connection, session or host. This also has the class verify the session handle that gets passed from userspace instead of using the pointer passed into the kernel directly. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: Alex Aizman <itn780@yahoo.com> Signed-off-by: Dmitry Yusupov <dmitry_yus@yahoo.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_transport_iscsi.c')
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c221
1 files changed, 112 insertions, 109 deletions
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 59a1c9d9d3bd..b61868587dca 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -164,9 +164,43 @@ static struct mempool_zone *z_reply;
164#define Z_MAX_ERROR 16 164#define Z_MAX_ERROR 16
165#define Z_HIWAT_ERROR 12 165#define Z_HIWAT_ERROR 12
166 166
167static LIST_HEAD(sesslist);
168static DEFINE_SPINLOCK(sesslock);
167static LIST_HEAD(connlist); 169static LIST_HEAD(connlist);
168static DEFINE_SPINLOCK(connlock); 170static DEFINE_SPINLOCK(connlock);
169 171
172static struct iscsi_cls_session *iscsi_session_lookup(uint64_t handle)
173{
174 unsigned long flags;
175 struct iscsi_cls_session *sess;
176
177 spin_lock_irqsave(&sesslock, flags);
178 list_for_each_entry(sess, &sesslist, sess_list) {
179 if (sess == iscsi_ptr(handle)) {
180 spin_unlock_irqrestore(&sesslock, flags);
181 return sess;
182 }
183 }
184 spin_unlock_irqrestore(&sesslock, flags);
185 return NULL;
186}
187
188static struct iscsi_cls_conn *iscsi_conn_lookup(uint64_t handle)
189{
190 unsigned long flags;
191 struct iscsi_cls_conn *conn;
192
193 spin_lock_irqsave(&connlock, flags);
194 list_for_each_entry(conn, &connlist, conn_list) {
195 if (conn == iscsi_ptr(handle)) {
196 spin_unlock_irqrestore(&connlock, flags);
197 return conn;
198 }
199 }
200 spin_unlock_irqrestore(&connlock, flags);
201 return NULL;
202}
203
170/* 204/*
171 * The following functions can be used by LLDs that allocate 205 * The following functions can be used by LLDs that allocate
172 * their own scsi_hosts or by software iscsi LLDs 206 * their own scsi_hosts or by software iscsi LLDs
@@ -365,6 +399,7 @@ iscsi_transport_create_session(struct scsi_transport_template *scsit,
365{ 399{
366 struct iscsi_cls_session *session; 400 struct iscsi_cls_session *session;
367 struct Scsi_Host *shost; 401 struct Scsi_Host *shost;
402 unsigned long flags;
368 403
369 shost = scsi_host_alloc(transport->host_template, 404 shost = scsi_host_alloc(transport->host_template,
370 hostdata_privsize(transport)); 405 hostdata_privsize(transport));
@@ -389,6 +424,9 @@ iscsi_transport_create_session(struct scsi_transport_template *scsit,
389 goto remove_host; 424 goto remove_host;
390 425
391 *(unsigned long*)shost->hostdata = (unsigned long)session; 426 *(unsigned long*)shost->hostdata = (unsigned long)session;
427 spin_lock_irqsave(&sesslock, flags);
428 list_add(&session->sess_list, &sesslist);
429 spin_unlock_irqrestore(&sesslock, flags);
392 return shost; 430 return shost;
393 431
394remove_host: 432remove_host:
@@ -410,9 +448,13 @@ EXPORT_SYMBOL_GPL(iscsi_transport_create_session);
410int iscsi_transport_destroy_session(struct Scsi_Host *shost) 448int iscsi_transport_destroy_session(struct Scsi_Host *shost)
411{ 449{
412 struct iscsi_cls_session *session; 450 struct iscsi_cls_session *session;
451 unsigned long flags;
413 452
414 scsi_remove_host(shost); 453 scsi_remove_host(shost);
415 session = hostdata_session(shost->hostdata); 454 session = hostdata_session(shost->hostdata);
455 spin_lock_irqsave(&sesslock, flags);
456 list_del(&session->sess_list);
457 spin_unlock_irqrestore(&sesslock, flags);
416 iscsi_destroy_session(session); 458 iscsi_destroy_session(session);
417 /* ref from host alloc */ 459 /* ref from host alloc */
418 scsi_host_put(shost); 460 scsi_host_put(shost);
@@ -424,22 +466,6 @@ EXPORT_SYMBOL_GPL(iscsi_transport_destroy_session);
424/* 466/*
425 * iscsi interface functions 467 * iscsi interface functions
426 */ 468 */
427static struct iscsi_cls_conn*
428iscsi_if_find_conn(uint64_t key)
429{
430 unsigned long flags;
431 struct iscsi_cls_conn *conn;
432
433 spin_lock_irqsave(&connlock, flags);
434 list_for_each_entry(conn, &connlist, conn_list)
435 if (conn->connh == key) {
436 spin_unlock_irqrestore(&connlock, flags);
437 return conn;
438 }
439 spin_unlock_irqrestore(&connlock, flags);
440 return NULL;
441}
442
443static struct iscsi_internal * 469static struct iscsi_internal *
444iscsi_if_transport_lookup(struct iscsi_transport *tt) 470iscsi_if_transport_lookup(struct iscsi_transport *tt)
445{ 471{
@@ -559,25 +585,21 @@ iscsi_unicast_skb(struct mempool_zone *zone, struct sk_buff *skb)
559 return 0; 585 return 0;
560} 586}
561 587
562int iscsi_recv_pdu(iscsi_connh_t connh, struct iscsi_hdr *hdr, 588int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
563 char *data, uint32_t data_size) 589 char *data, uint32_t data_size)
564{ 590{
565 struct nlmsghdr *nlh; 591 struct nlmsghdr *nlh;
566 struct sk_buff *skb; 592 struct sk_buff *skb;
567 struct iscsi_uevent *ev; 593 struct iscsi_uevent *ev;
568 struct iscsi_cls_conn *conn;
569 char *pdu; 594 char *pdu;
570 int len = NLMSG_SPACE(sizeof(*ev) + sizeof(struct iscsi_hdr) + 595 int len = NLMSG_SPACE(sizeof(*ev) + sizeof(struct iscsi_hdr) +
571 data_size); 596 data_size);
572 597
573 conn = iscsi_if_find_conn(connh);
574 BUG_ON(!conn);
575
576 mempool_zone_complete(conn->z_pdu); 598 mempool_zone_complete(conn->z_pdu);
577 599
578 skb = mempool_zone_get_skb(conn->z_pdu); 600 skb = mempool_zone_get_skb(conn->z_pdu);
579 if (!skb) { 601 if (!skb) {
580 iscsi_conn_error(connh, ISCSI_ERR_CONN_FAILED); 602 iscsi_conn_error(conn, ISCSI_ERR_CONN_FAILED);
581 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not deliver " 603 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not deliver "
582 "control PDU: OOM\n"); 604 "control PDU: OOM\n");
583 return -ENOMEM; 605 return -ENOMEM;
@@ -590,7 +612,7 @@ int iscsi_recv_pdu(iscsi_connh_t connh, struct iscsi_hdr *hdr,
590 ev->type = ISCSI_KEVENT_RECV_PDU; 612 ev->type = ISCSI_KEVENT_RECV_PDU;
591 if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat) 613 if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat)
592 ev->iferror = -ENOMEM; 614 ev->iferror = -ENOMEM;
593 ev->r.recv_req.conn_handle = connh; 615 ev->r.recv_req.conn_handle = iscsi_handle(conn);
594 pdu = (char*)ev + sizeof(*ev); 616 pdu = (char*)ev + sizeof(*ev);
595 memcpy(pdu, hdr, sizeof(struct iscsi_hdr)); 617 memcpy(pdu, hdr, sizeof(struct iscsi_hdr));
596 memcpy(pdu + sizeof(struct iscsi_hdr), data, data_size); 618 memcpy(pdu + sizeof(struct iscsi_hdr), data, data_size);
@@ -599,17 +621,13 @@ int iscsi_recv_pdu(iscsi_connh_t connh, struct iscsi_hdr *hdr,
599} 621}
600EXPORT_SYMBOL_GPL(iscsi_recv_pdu); 622EXPORT_SYMBOL_GPL(iscsi_recv_pdu);
601 623
602void iscsi_conn_error(iscsi_connh_t connh, enum iscsi_err error) 624void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error)
603{ 625{
604 struct nlmsghdr *nlh; 626 struct nlmsghdr *nlh;
605 struct sk_buff *skb; 627 struct sk_buff *skb;
606 struct iscsi_uevent *ev; 628 struct iscsi_uevent *ev;
607 struct iscsi_cls_conn *conn;
608 int len = NLMSG_SPACE(sizeof(*ev)); 629 int len = NLMSG_SPACE(sizeof(*ev));
609 630
610 conn = iscsi_if_find_conn(connh);
611 BUG_ON(!conn);
612
613 mempool_zone_complete(conn->z_error); 631 mempool_zone_complete(conn->z_error);
614 632
615 skb = mempool_zone_get_skb(conn->z_error); 633 skb = mempool_zone_get_skb(conn->z_error);
@@ -626,7 +644,7 @@ void iscsi_conn_error(iscsi_connh_t connh, enum iscsi_err error)
626 if (atomic_read(&conn->z_error->allocated) >= conn->z_error->hiwat) 644 if (atomic_read(&conn->z_error->allocated) >= conn->z_error->hiwat)
627 ev->iferror = -ENOMEM; 645 ev->iferror = -ENOMEM;
628 ev->r.connerror.error = error; 646 ev->r.connerror.error = error;
629 ev->r.connerror.conn_handle = connh; 647 ev->r.connerror.conn_handle = iscsi_handle(conn);
630 648
631 iscsi_unicast_skb(conn->z_error, skb); 649 iscsi_unicast_skb(conn->z_error, skb);
632 650
@@ -677,7 +695,7 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct sk_buff *skb,
677 ISCSI_STATS_CUSTOM_MAX); 695 ISCSI_STATS_CUSTOM_MAX);
678 int err = 0; 696 int err = 0;
679 697
680 conn = iscsi_if_find_conn(ev->u.get_stats.conn_handle); 698 conn = iscsi_conn_lookup(ev->u.get_stats.conn_handle);
681 if (!conn) 699 if (!conn)
682 return -EEXIST; 700 return -EEXIST;
683 701
@@ -707,7 +725,7 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct sk_buff *skb,
707 ((char*)evstat + sizeof(*evstat)); 725 ((char*)evstat + sizeof(*evstat));
708 memset(stats, 0, sizeof(*stats)); 726 memset(stats, 0, sizeof(*stats));
709 727
710 transport->get_stats(ev->u.get_stats.conn_handle, stats); 728 transport->get_stats(conn, stats);
711 actual_size = NLMSG_SPACE(sizeof(struct iscsi_uevent) + 729 actual_size = NLMSG_SPACE(sizeof(struct iscsi_uevent) +
712 sizeof(struct iscsi_stats) + 730 sizeof(struct iscsi_stats) +
713 sizeof(struct iscsi_stats_custom) * 731 sizeof(struct iscsi_stats_custom) *
@@ -727,58 +745,34 @@ static int
727iscsi_if_create_session(struct iscsi_internal *priv, struct iscsi_uevent *ev) 745iscsi_if_create_session(struct iscsi_internal *priv, struct iscsi_uevent *ev)
728{ 746{
729 struct iscsi_transport *transport = priv->iscsi_transport; 747 struct iscsi_transport *transport = priv->iscsi_transport;
730 struct Scsi_Host *shost; 748 struct iscsi_cls_session *session;
731 749 uint32_t sid;
732 if (!transport->create_session)
733 return -EINVAL;
734 750
735 shost = transport->create_session(&priv->t, 751 session = transport->create_session(&priv->t,
736 ev->u.c_session.initial_cmdsn); 752 ev->u.c_session.initial_cmdsn,
737 if (!shost) 753 &sid);
754 if (!session)
738 return -ENOMEM; 755 return -ENOMEM;
739 756
740 ev->r.c_session_ret.session_handle = iscsi_handle(iscsi_hostdata(shost->hostdata)); 757 ev->r.c_session_ret.session_handle = iscsi_handle(session);
741 ev->r.c_session_ret.sid = shost->host_no; 758 ev->r.c_session_ret.sid = sid;
742 return 0; 759 return 0;
743} 760}
744 761
745static int 762static int
746iscsi_if_destroy_session(struct iscsi_internal *priv, struct iscsi_uevent *ev) 763iscsi_if_create_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev)
747{ 764{
748 struct iscsi_transport *transport = priv->iscsi_transport;
749
750 struct Scsi_Host *shost;
751
752 if (!transport->destroy_session)
753 return -EINVAL;
754
755 shost = scsi_host_lookup(ev->u.d_session.sid);
756 if (shost == ERR_PTR(-ENXIO))
757 return -EEXIST;
758
759 if (transport->destroy_session)
760 transport->destroy_session(shost);
761 /* ref from host lookup */
762 scsi_host_put(shost);
763 return 0;
764}
765
766static int
767iscsi_if_create_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev){
768 struct Scsi_Host *shost;
769 struct iscsi_cls_conn *conn; 765 struct iscsi_cls_conn *conn;
766 struct iscsi_cls_session *session;
770 unsigned long flags; 767 unsigned long flags;
771 768
772 if (!transport->create_conn) 769 session = iscsi_session_lookup(ev->u.c_conn.session_handle);
770 if (!session)
773 return -EINVAL; 771 return -EINVAL;
774 772
775 shost = scsi_host_lookup(ev->u.c_conn.sid); 773 conn = transport->create_conn(session, ev->u.c_conn.cid);
776 if (shost == ERR_PTR(-ENXIO))
777 return -EEXIST;
778
779 conn = transport->create_conn(shost, ev->u.c_conn.cid);
780 if (!conn) 774 if (!conn)
781 goto release_ref; 775 return -ENOMEM;
782 776
783 conn->z_pdu = mempool_zone_init(Z_MAX_PDU, 777 conn->z_pdu = mempool_zone_init(Z_MAX_PDU,
784 NLMSG_SPACE(sizeof(struct iscsi_uevent) + 778 NLMSG_SPACE(sizeof(struct iscsi_uevent) +
@@ -800,14 +794,13 @@ iscsi_if_create_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev)
800 goto free_pdu_pool; 794 goto free_pdu_pool;
801 } 795 }
802 796
803 ev->r.handle = conn->connh = iscsi_handle(conn->dd_data); 797 ev->r.handle = iscsi_handle(conn);
804 798
805 spin_lock_irqsave(&connlock, flags); 799 spin_lock_irqsave(&connlock, flags);
806 list_add(&conn->conn_list, &connlist); 800 list_add(&conn->conn_list, &connlist);
807 conn->active = 1; 801 conn->active = 1;
808 spin_unlock_irqrestore(&connlock, flags); 802 spin_unlock_irqrestore(&connlock, flags);
809 803
810 scsi_host_put(shost);
811 return 0; 804 return 0;
812 805
813free_pdu_pool: 806free_pdu_pool:
@@ -815,8 +808,6 @@ free_pdu_pool:
815destroy_conn: 808destroy_conn:
816 if (transport->destroy_conn) 809 if (transport->destroy_conn)
817 transport->destroy_conn(conn->dd_data); 810 transport->destroy_conn(conn->dd_data);
818release_ref:
819 scsi_host_put(shost);
820 return -ENOMEM; 811 return -ENOMEM;
821} 812}
822 813
@@ -827,13 +818,9 @@ iscsi_if_destroy_conn(struct iscsi_transport *transport, struct iscsi_uevent *ev
827 struct iscsi_cls_conn *conn; 818 struct iscsi_cls_conn *conn;
828 struct mempool_zone *z_error, *z_pdu; 819 struct mempool_zone *z_error, *z_pdu;
829 820
830 conn = iscsi_if_find_conn(ev->u.d_conn.conn_handle); 821 conn = iscsi_conn_lookup(ev->u.d_conn.conn_handle);
831 if (!conn) 822 if (!conn)
832 return -EEXIST;
833
834 if (!transport->destroy_conn)
835 return -EINVAL; 823 return -EINVAL;
836
837 spin_lock_irqsave(&connlock, flags); 824 spin_lock_irqsave(&connlock, flags);
838 conn->active = 0; 825 conn->active = 0;
839 list_del(&conn->conn_list); 826 list_del(&conn->conn_list);
@@ -858,6 +845,8 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
858 struct iscsi_uevent *ev = NLMSG_DATA(nlh); 845 struct iscsi_uevent *ev = NLMSG_DATA(nlh);
859 struct iscsi_transport *transport = NULL; 846 struct iscsi_transport *transport = NULL;
860 struct iscsi_internal *priv; 847 struct iscsi_internal *priv;
848 struct iscsi_cls_session *session;
849 struct iscsi_cls_conn *conn;
861 850
862 if (NETLINK_CREDS(skb)->uid) 851 if (NETLINK_CREDS(skb)->uid)
863 return -EPERM; 852 return -EPERM;
@@ -867,6 +856,9 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
867 return -EINVAL; 856 return -EINVAL;
868 transport = priv->iscsi_transport; 857 transport = priv->iscsi_transport;
869 858
859 if (!try_module_get(transport->owner))
860 return -EINVAL;
861
870 daemon_pid = NETLINK_CREDS(skb)->pid; 862 daemon_pid = NETLINK_CREDS(skb)->pid;
871 863
872 switch (nlh->nlmsg_type) { 864 switch (nlh->nlmsg_type) {
@@ -874,7 +866,11 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
874 err = iscsi_if_create_session(priv, ev); 866 err = iscsi_if_create_session(priv, ev);
875 break; 867 break;
876 case ISCSI_UEVENT_DESTROY_SESSION: 868 case ISCSI_UEVENT_DESTROY_SESSION:
877 err = iscsi_if_destroy_session(priv, ev); 869 session = iscsi_session_lookup(ev->u.d_session.session_handle);
870 if (session)
871 transport->destroy_session(session);
872 else
873 err = -EINVAL;
878 break; 874 break;
879 case ISCSI_UEVENT_CREATE_CONN: 875 case ISCSI_UEVENT_CREATE_CONN:
880 err = iscsi_if_create_conn(transport, ev); 876 err = iscsi_if_create_conn(transport, ev);
@@ -883,41 +879,48 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
883 err = iscsi_if_destroy_conn(transport, ev); 879 err = iscsi_if_destroy_conn(transport, ev);
884 break; 880 break;
885 case ISCSI_UEVENT_BIND_CONN: 881 case ISCSI_UEVENT_BIND_CONN:
886 if (!iscsi_if_find_conn(ev->u.b_conn.conn_handle)) 882 session = iscsi_session_lookup(ev->u.b_conn.session_handle);
887 return -EEXIST; 883 conn = iscsi_conn_lookup(ev->u.b_conn.conn_handle);
888 ev->r.retcode = transport->bind_conn( 884
889 ev->u.b_conn.session_handle, 885 if (session && conn)
890 ev->u.b_conn.conn_handle, 886 ev->r.retcode = transport->bind_conn(session, conn,
891 ev->u.b_conn.transport_fd, 887 ev->u.b_conn.transport_fd,
892 ev->u.b_conn.is_leading); 888 ev->u.b_conn.is_leading);
889 else
890 err = -EINVAL;
893 break; 891 break;
894 case ISCSI_UEVENT_SET_PARAM: 892 case ISCSI_UEVENT_SET_PARAM:
895 if (!iscsi_if_find_conn(ev->u.set_param.conn_handle)) 893 conn = iscsi_conn_lookup(ev->u.set_param.conn_handle);
896 return -EEXIST; 894 if (conn)
897 ev->r.retcode = transport->set_param( 895 ev->r.retcode = transport->set_param(conn,
898 ev->u.set_param.conn_handle, 896 ev->u.set_param.param, ev->u.set_param.value);
899 ev->u.set_param.param, ev->u.set_param.value); 897 else
898 err = -EINVAL;
900 break; 899 break;
901 case ISCSI_UEVENT_START_CONN: 900 case ISCSI_UEVENT_START_CONN:
902 if (!iscsi_if_find_conn(ev->u.start_conn.conn_handle)) 901 conn = iscsi_conn_lookup(ev->u.start_conn.conn_handle);
903 return -EEXIST; 902 if (conn)
904 ev->r.retcode = transport->start_conn( 903 ev->r.retcode = transport->start_conn(conn);
905 ev->u.start_conn.conn_handle); 904 else
905 err = -EINVAL;
906
906 break; 907 break;
907 case ISCSI_UEVENT_STOP_CONN: 908 case ISCSI_UEVENT_STOP_CONN:
908 if (!iscsi_if_find_conn(ev->u.stop_conn.conn_handle)) 909 conn = iscsi_conn_lookup(ev->u.stop_conn.conn_handle);
909 return -EEXIST; 910 if (conn)
910 transport->stop_conn(ev->u.stop_conn.conn_handle, 911 transport->stop_conn(conn, ev->u.stop_conn.flag);
911 ev->u.stop_conn.flag); 912 else
913 err = -EINVAL;
912 break; 914 break;
913 case ISCSI_UEVENT_SEND_PDU: 915 case ISCSI_UEVENT_SEND_PDU:
914 if (!iscsi_if_find_conn(ev->u.send_pdu.conn_handle)) 916 conn = iscsi_conn_lookup(ev->u.send_pdu.conn_handle);
915 return -EEXIST; 917 if (conn)
916 ev->r.retcode = transport->send_pdu( 918 ev->r.retcode = transport->send_pdu(conn,
917 ev->u.send_pdu.conn_handle, 919 (struct iscsi_hdr*)((char*)ev + sizeof(*ev)),
918 (struct iscsi_hdr*)((char*)ev + sizeof(*ev)), 920 (char*)ev + sizeof(*ev) + ev->u.send_pdu.hdr_size,
919 (char*)ev + sizeof(*ev) + ev->u.send_pdu.hdr_size, 921 ev->u.send_pdu.data_size);
920 ev->u.send_pdu.data_size); 922 else
923 err = -EINVAL;
921 break; 924 break;
922 case ISCSI_UEVENT_GET_STATS: 925 case ISCSI_UEVENT_GET_STATS:
923 err = iscsi_if_get_stats(transport, skb, nlh); 926 err = iscsi_if_get_stats(transport, skb, nlh);
@@ -927,6 +930,7 @@ iscsi_if_recv_msg(struct sk_buff *skb, struct nlmsghdr *nlh)
927 break; 930 break;
928 } 931 }
929 932
933 module_put(transport->owner);
930 return err; 934 return err;
931} 935}
932 936
@@ -997,7 +1001,7 @@ show_conn_int_param_##param(struct class_device *cdev, char *buf) \
997 struct iscsi_cls_conn *conn = iscsi_cdev_to_conn(cdev); \ 1001 struct iscsi_cls_conn *conn = iscsi_cdev_to_conn(cdev); \
998 struct iscsi_transport *t = conn->transport; \ 1002 struct iscsi_transport *t = conn->transport; \
999 \ 1003 \
1000 t->get_conn_param(conn->dd_data, param, &value); \ 1004 t->get_conn_param(conn, param, &value); \
1001 return snprintf(buf, 20, format"\n", value); \ 1005 return snprintf(buf, 20, format"\n", value); \
1002} 1006}
1003 1007
@@ -1024,10 +1028,9 @@ show_session_int_param_##param(struct class_device *cdev, char *buf) \
1024{ \ 1028{ \
1025 uint32_t value = 0; \ 1029 uint32_t value = 0; \
1026 struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev); \ 1030 struct iscsi_cls_session *session = iscsi_cdev_to_session(cdev); \
1027 struct Scsi_Host *shost = iscsi_session_to_shost(session); \
1028 struct iscsi_transport *t = session->transport; \ 1031 struct iscsi_transport *t = session->transport; \
1029 \ 1032 \
1030 t->get_session_param(shost, param, &value); \ 1033 t->get_session_param(session, param, &value); \
1031 return snprintf(buf, 20, format"\n", value); \ 1034 return snprintf(buf, 20, format"\n", value); \
1032} 1035}
1033 1036