aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/scsi/scsi_transport_iscsi.c246
-rw-r--r--include/scsi/scsi_transport_iscsi.h4
2 files changed, 17 insertions, 233 deletions
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index 7b0019cccce3..2d3baa99ca25 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -21,7 +21,6 @@
21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22 */ 22 */
23#include <linux/module.h> 23#include <linux/module.h>
24#include <linux/mempool.h>
25#include <linux/mutex.h> 24#include <linux/mutex.h>
26#include <net/tcp.h> 25#include <net/tcp.h>
27#include <scsi/scsi.h> 26#include <scsi/scsi.h>
@@ -149,30 +148,6 @@ static DECLARE_TRANSPORT_CLASS(iscsi_connection_class,
149static struct sock *nls; 148static struct sock *nls;
150static DEFINE_MUTEX(rx_queue_mutex); 149static DEFINE_MUTEX(rx_queue_mutex);
151 150
152struct mempool_zone {
153 mempool_t *pool;
154 atomic_t allocated;
155 int size;
156 int hiwat;
157 struct list_head freequeue;
158 spinlock_t freelock;
159};
160
161static struct mempool_zone *z_reply;
162
163/*
164 * Z_MAX_* - actual mempool size allocated at the mempool_zone_init() time
165 * Z_HIWAT_* - zone's high watermark when if_error bit will be set to -ENOMEM
166 * so daemon will notice OOM on NETLINK tranposrt level and will
167 * be able to predict or change operational behavior
168 */
169#define Z_MAX_REPLY 8
170#define Z_HIWAT_REPLY 6
171#define Z_MAX_PDU 8
172#define Z_HIWAT_PDU 6
173#define Z_MAX_ERROR 16
174#define Z_HIWAT_ERROR 12
175
176static LIST_HEAD(sesslist); 151static LIST_HEAD(sesslist);
177static DEFINE_SPINLOCK(sesslock); 152static DEFINE_SPINLOCK(sesslock);
178static LIST_HEAD(connlist); 153static LIST_HEAD(connlist);
@@ -414,59 +389,11 @@ int iscsi_destroy_session(struct iscsi_cls_session *session)
414} 389}
415EXPORT_SYMBOL_GPL(iscsi_destroy_session); 390EXPORT_SYMBOL_GPL(iscsi_destroy_session);
416 391
417static void mempool_zone_destroy(struct mempool_zone *zp)
418{
419 mempool_destroy(zp->pool);
420 kfree(zp);
421}
422
423static void*
424mempool_zone_alloc_skb(gfp_t gfp_mask, void *pool_data)
425{
426 struct mempool_zone *zone = pool_data;
427
428 return alloc_skb(zone->size, gfp_mask);
429}
430
431static void
432mempool_zone_free_skb(void *element, void *pool_data)
433{
434 kfree_skb(element);
435}
436
437static struct mempool_zone *
438mempool_zone_init(unsigned max, unsigned size, unsigned hiwat)
439{
440 struct mempool_zone *zp;
441
442 zp = kzalloc(sizeof(*zp), GFP_KERNEL);
443 if (!zp)
444 return NULL;
445
446 zp->size = size;
447 zp->hiwat = hiwat;
448 INIT_LIST_HEAD(&zp->freequeue);
449 spin_lock_init(&zp->freelock);
450 atomic_set(&zp->allocated, 0);
451
452 zp->pool = mempool_create(max, mempool_zone_alloc_skb,
453 mempool_zone_free_skb, zp);
454 if (!zp->pool) {
455 kfree(zp);
456 return NULL;
457 }
458
459 return zp;
460}
461
462static void iscsi_conn_release(struct device *dev) 392static void iscsi_conn_release(struct device *dev)
463{ 393{
464 struct iscsi_cls_conn *conn = iscsi_dev_to_conn(dev); 394 struct iscsi_cls_conn *conn = iscsi_dev_to_conn(dev);
465 struct device *parent = conn->dev.parent; 395 struct device *parent = conn->dev.parent;
466 396
467 mempool_zone_destroy(conn->z_pdu);
468 mempool_zone_destroy(conn->z_error);
469
470 kfree(conn); 397 kfree(conn);
471 put_device(parent); 398 put_device(parent);
472} 399}
@@ -476,31 +403,6 @@ static int iscsi_is_conn_dev(const struct device *dev)
476 return dev->release == iscsi_conn_release; 403 return dev->release == iscsi_conn_release;
477} 404}
478 405
479static int iscsi_create_event_pools(struct iscsi_cls_conn *conn)
480{
481 conn->z_pdu = mempool_zone_init(Z_MAX_PDU,
482 NLMSG_SPACE(sizeof(struct iscsi_uevent) +
483 sizeof(struct iscsi_hdr) +
484 DEFAULT_MAX_RECV_DATA_SEGMENT_LENGTH),
485 Z_HIWAT_PDU);
486 if (!conn->z_pdu) {
487 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not allocate "
488 "pdu zone for new conn\n");
489 return -ENOMEM;
490 }
491
492 conn->z_error = mempool_zone_init(Z_MAX_ERROR,
493 NLMSG_SPACE(sizeof(struct iscsi_uevent)),
494 Z_HIWAT_ERROR);
495 if (!conn->z_error) {
496 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not allocate "
497 "error zone for new conn\n");
498 mempool_zone_destroy(conn->z_pdu);
499 return -ENOMEM;
500 }
501 return 0;
502}
503
504/** 406/**
505 * iscsi_create_conn - create iscsi class connection 407 * iscsi_create_conn - create iscsi class connection
506 * @session: iscsi cls session 408 * @session: iscsi cls session
@@ -533,12 +435,9 @@ iscsi_create_conn(struct iscsi_cls_session *session, uint32_t cid)
533 conn->transport = transport; 435 conn->transport = transport;
534 conn->cid = cid; 436 conn->cid = cid;
535 437
536 if (iscsi_create_event_pools(conn))
537 goto free_conn;
538
539 /* this is released in the dev's release function */ 438 /* this is released in the dev's release function */
540 if (!get_device(&session->dev)) 439 if (!get_device(&session->dev))
541 goto free_conn_pools; 440 goto free_conn;
542 441
543 snprintf(conn->dev.bus_id, BUS_ID_SIZE, "connection%d:%u", 442 snprintf(conn->dev.bus_id, BUS_ID_SIZE, "connection%d:%u",
544 session->sid, cid); 443 session->sid, cid);
@@ -555,8 +454,6 @@ iscsi_create_conn(struct iscsi_cls_session *session, uint32_t cid)
555 454
556release_parent_ref: 455release_parent_ref:
557 put_device(&session->dev); 456 put_device(&session->dev);
558free_conn_pools:
559
560free_conn: 457free_conn:
561 kfree(conn); 458 kfree(conn);
562 return NULL; 459 return NULL;
@@ -599,81 +496,31 @@ iscsi_if_transport_lookup(struct iscsi_transport *tt)
599 return NULL; 496 return NULL;
600} 497}
601 498
602static inline struct list_head *skb_to_lh(struct sk_buff *skb)
603{
604 return (struct list_head *)&skb->cb;
605}
606
607static void
608mempool_zone_complete(struct mempool_zone *zone)
609{
610 unsigned long flags;
611 struct list_head *lh, *n;
612
613 spin_lock_irqsave(&zone->freelock, flags);
614 list_for_each_safe(lh, n, &zone->freequeue) {
615 struct sk_buff *skb = (struct sk_buff *)((char *)lh -
616 offsetof(struct sk_buff, cb));
617 if (!skb_shared(skb)) {
618 list_del(skb_to_lh(skb));
619 mempool_free(skb, zone->pool);
620 atomic_dec(&zone->allocated);
621 }
622 }
623 spin_unlock_irqrestore(&zone->freelock, flags);
624}
625
626static struct sk_buff*
627mempool_zone_get_skb(struct mempool_zone *zone)
628{
629 struct sk_buff *skb;
630
631 skb = mempool_alloc(zone->pool, GFP_ATOMIC);
632 if (skb)
633 atomic_inc(&zone->allocated);
634 return skb;
635}
636
637static int 499static int
638iscsi_broadcast_skb(struct mempool_zone *zone, struct sk_buff *skb, gfp_t gfp) 500iscsi_broadcast_skb(struct sk_buff *skb, gfp_t gfp)
639{ 501{
640 unsigned long flags;
641 int rc; 502 int rc;
642 503
643 skb_get(skb);
644 rc = netlink_broadcast(nls, skb, 0, 1, gfp); 504 rc = netlink_broadcast(nls, skb, 0, 1, gfp);
645 if (rc < 0) { 505 if (rc < 0) {
646 mempool_free(skb, zone->pool);
647 printk(KERN_ERR "iscsi: can not broadcast skb (%d)\n", rc); 506 printk(KERN_ERR "iscsi: can not broadcast skb (%d)\n", rc);
648 return rc; 507 return rc;
649 } 508 }
650 509
651 spin_lock_irqsave(&zone->freelock, flags);
652 INIT_LIST_HEAD(skb_to_lh(skb));
653 list_add(skb_to_lh(skb), &zone->freequeue);
654 spin_unlock_irqrestore(&zone->freelock, flags);
655 return 0; 510 return 0;
656} 511}
657 512
658static int 513static int
659iscsi_unicast_skb(struct mempool_zone *zone, struct sk_buff *skb, int pid) 514iscsi_unicast_skb(struct sk_buff *skb, int pid)
660{ 515{
661 unsigned long flags;
662 int rc; 516 int rc;
663 517
664 skb_get(skb);
665 rc = netlink_unicast(nls, skb, pid, MSG_DONTWAIT); 518 rc = netlink_unicast(nls, skb, pid, MSG_DONTWAIT);
666 if (rc < 0) { 519 if (rc < 0) {
667 mempool_free(skb, zone->pool);
668 printk(KERN_ERR "iscsi: can not unicast skb (%d)\n", rc); 520 printk(KERN_ERR "iscsi: can not unicast skb (%d)\n", rc);
669 return rc; 521 return rc;
670 } 522 }
671 523
672 spin_lock_irqsave(&zone->freelock, flags);
673 INIT_LIST_HEAD(skb_to_lh(skb));
674 list_add(skb_to_lh(skb), &zone->freequeue);
675 spin_unlock_irqrestore(&zone->freelock, flags);
676
677 return 0; 524 return 0;
678} 525}
679 526
@@ -692,9 +539,7 @@ int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
692 if (!priv) 539 if (!priv)
693 return -EINVAL; 540 return -EINVAL;
694 541
695 mempool_zone_complete(conn->z_pdu); 542 skb = alloc_skb(len, GFP_ATOMIC);
696
697 skb = mempool_zone_get_skb(conn->z_pdu);
698 if (!skb) { 543 if (!skb) {
699 iscsi_conn_error(conn, ISCSI_ERR_CONN_FAILED); 544 iscsi_conn_error(conn, ISCSI_ERR_CONN_FAILED);
700 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not deliver " 545 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not deliver "
@@ -707,15 +552,13 @@ int iscsi_recv_pdu(struct iscsi_cls_conn *conn, struct iscsi_hdr *hdr,
707 memset(ev, 0, sizeof(*ev)); 552 memset(ev, 0, sizeof(*ev));
708 ev->transport_handle = iscsi_handle(conn->transport); 553 ev->transport_handle = iscsi_handle(conn->transport);
709 ev->type = ISCSI_KEVENT_RECV_PDU; 554 ev->type = ISCSI_KEVENT_RECV_PDU;
710 if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat)
711 ev->iferror = -ENOMEM;
712 ev->r.recv_req.cid = conn->cid; 555 ev->r.recv_req.cid = conn->cid;
713 ev->r.recv_req.sid = iscsi_conn_get_sid(conn); 556 ev->r.recv_req.sid = iscsi_conn_get_sid(conn);
714 pdu = (char*)ev + sizeof(*ev); 557 pdu = (char*)ev + sizeof(*ev);
715 memcpy(pdu, hdr, sizeof(struct iscsi_hdr)); 558 memcpy(pdu, hdr, sizeof(struct iscsi_hdr));
716 memcpy(pdu + sizeof(struct iscsi_hdr), data, data_size); 559 memcpy(pdu + sizeof(struct iscsi_hdr), data, data_size);
717 560
718 return iscsi_unicast_skb(conn->z_pdu, skb, priv->daemon_pid); 561 return iscsi_unicast_skb(skb, priv->daemon_pid);
719} 562}
720EXPORT_SYMBOL_GPL(iscsi_recv_pdu); 563EXPORT_SYMBOL_GPL(iscsi_recv_pdu);
721 564
@@ -731,9 +574,7 @@ void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error)
731 if (!priv) 574 if (!priv)
732 return; 575 return;
733 576
734 mempool_zone_complete(conn->z_error); 577 skb = alloc_skb(len, GFP_ATOMIC);
735
736 skb = mempool_zone_get_skb(conn->z_error);
737 if (!skb) { 578 if (!skb) {
738 dev_printk(KERN_ERR, &conn->dev, "iscsi: gracefully ignored " 579 dev_printk(KERN_ERR, &conn->dev, "iscsi: gracefully ignored "
739 "conn error (%d)\n", error); 580 "conn error (%d)\n", error);
@@ -744,13 +585,11 @@ void iscsi_conn_error(struct iscsi_cls_conn *conn, enum iscsi_err error)
744 ev = NLMSG_DATA(nlh); 585 ev = NLMSG_DATA(nlh);
745 ev->transport_handle = iscsi_handle(conn->transport); 586 ev->transport_handle = iscsi_handle(conn->transport);
746 ev->type = ISCSI_KEVENT_CONN_ERROR; 587 ev->type = ISCSI_KEVENT_CONN_ERROR;
747 if (atomic_read(&conn->z_error->allocated) >= conn->z_error->hiwat)
748 ev->iferror = -ENOMEM;
749 ev->r.connerror.error = error; 588 ev->r.connerror.error = error;
750 ev->r.connerror.cid = conn->cid; 589 ev->r.connerror.cid = conn->cid;
751 ev->r.connerror.sid = iscsi_conn_get_sid(conn); 590 ev->r.connerror.sid = iscsi_conn_get_sid(conn);
752 591
753 iscsi_broadcast_skb(conn->z_error, skb, GFP_ATOMIC); 592 iscsi_broadcast_skb(skb, GFP_ATOMIC);
754 593
755 dev_printk(KERN_INFO, &conn->dev, "iscsi: detected conn error (%d)\n", 594 dev_printk(KERN_INFO, &conn->dev, "iscsi: detected conn error (%d)\n",
756 error); 595 error);
@@ -767,9 +606,7 @@ iscsi_if_send_reply(int pid, int seq, int type, int done, int multi,
767 int flags = multi ? NLM_F_MULTI : 0; 606 int flags = multi ? NLM_F_MULTI : 0;
768 int t = done ? NLMSG_DONE : type; 607 int t = done ? NLMSG_DONE : type;
769 608
770 mempool_zone_complete(z_reply); 609 skb = alloc_skb(len, GFP_ATOMIC);
771
772 skb = mempool_zone_get_skb(z_reply);
773 /* 610 /*
774 * FIXME: 611 * FIXME:
775 * user is supposed to react on iferror == -ENOMEM; 612 * user is supposed to react on iferror == -ENOMEM;
@@ -780,7 +617,7 @@ iscsi_if_send_reply(int pid, int seq, int type, int done, int multi,
780 nlh = __nlmsg_put(skb, pid, seq, t, (len - sizeof(*nlh)), 0); 617 nlh = __nlmsg_put(skb, pid, seq, t, (len - sizeof(*nlh)), 0);
781 nlh->nlmsg_flags = flags; 618 nlh->nlmsg_flags = flags;
782 memcpy(NLMSG_DATA(nlh), payload, size); 619 memcpy(NLMSG_DATA(nlh), payload, size);
783 return iscsi_unicast_skb(z_reply, skb, pid); 620 return iscsi_unicast_skb(skb, pid);
784} 621}
785 622
786static int 623static int
@@ -810,9 +647,7 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh)
810 do { 647 do {
811 int actual_size; 648 int actual_size;
812 649
813 mempool_zone_complete(conn->z_pdu); 650 skbstat = alloc_skb(len, GFP_ATOMIC);
814
815 skbstat = mempool_zone_get_skb(conn->z_pdu);
816 if (!skbstat) { 651 if (!skbstat) {
817 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not " 652 dev_printk(KERN_ERR, &conn->dev, "iscsi: can not "
818 "deliver stats: OOM\n"); 653 "deliver stats: OOM\n");
@@ -825,8 +660,6 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh)
825 memset(evstat, 0, sizeof(*evstat)); 660 memset(evstat, 0, sizeof(*evstat));
826 evstat->transport_handle = iscsi_handle(conn->transport); 661 evstat->transport_handle = iscsi_handle(conn->transport);
827 evstat->type = nlh->nlmsg_type; 662 evstat->type = nlh->nlmsg_type;
828 if (atomic_read(&conn->z_pdu->allocated) >= conn->z_pdu->hiwat)
829 evstat->iferror = -ENOMEM;
830 evstat->u.get_stats.cid = 663 evstat->u.get_stats.cid =
831 ev->u.get_stats.cid; 664 ev->u.get_stats.cid;
832 evstat->u.get_stats.sid = 665 evstat->u.get_stats.sid =
@@ -845,7 +678,7 @@ iscsi_if_get_stats(struct iscsi_transport *transport, struct nlmsghdr *nlh)
845 skb_trim(skbstat, NLMSG_ALIGN(actual_size)); 678 skb_trim(skbstat, NLMSG_ALIGN(actual_size));
846 nlhstat->nlmsg_len = actual_size; 679 nlhstat->nlmsg_len = actual_size;
847 680
848 err = iscsi_unicast_skb(conn->z_pdu, skbstat, priv->daemon_pid); 681 err = iscsi_unicast_skb(skbstat, priv->daemon_pid);
849 } while (err < 0 && err != -ECONNREFUSED); 682 } while (err < 0 && err != -ECONNREFUSED);
850 683
851 return err; 684 return err;
@@ -876,9 +709,7 @@ int iscsi_if_destroy_session_done(struct iscsi_cls_conn *conn)
876 session = iscsi_dev_to_session(conn->dev.parent); 709 session = iscsi_dev_to_session(conn->dev.parent);
877 shost = iscsi_session_to_shost(session); 710 shost = iscsi_session_to_shost(session);
878 711
879 mempool_zone_complete(conn->z_pdu); 712 skb = alloc_skb(len, GFP_KERNEL);
880
881 skb = mempool_zone_get_skb(conn->z_pdu);
882 if (!skb) { 713 if (!skb) {
883 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " 714 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of "
884 "session creation event\n"); 715 "session creation event\n");
@@ -896,7 +727,7 @@ int iscsi_if_destroy_session_done(struct iscsi_cls_conn *conn)
896 * this will occur if the daemon is not up, so we just warn 727 * this will occur if the daemon is not up, so we just warn
897 * the user and when the daemon is restarted it will handle it 728 * the user and when the daemon is restarted it will handle it
898 */ 729 */
899 rc = iscsi_broadcast_skb(conn->z_pdu, skb, GFP_KERNEL); 730 rc = iscsi_broadcast_skb(skb, GFP_KERNEL);
900 if (rc < 0) 731 if (rc < 0)
901 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " 732 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of "
902 "session destruction event. Check iscsi daemon\n"); 733 "session destruction event. Check iscsi daemon\n");
@@ -939,9 +770,7 @@ int iscsi_if_create_session_done(struct iscsi_cls_conn *conn)
939 session = iscsi_dev_to_session(conn->dev.parent); 770 session = iscsi_dev_to_session(conn->dev.parent);
940 shost = iscsi_session_to_shost(session); 771 shost = iscsi_session_to_shost(session);
941 772
942 mempool_zone_complete(conn->z_pdu); 773 skb = alloc_skb(len, GFP_KERNEL);
943
944 skb = mempool_zone_get_skb(conn->z_pdu);
945 if (!skb) { 774 if (!skb) {
946 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " 775 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of "
947 "session creation event\n"); 776 "session creation event\n");
@@ -959,7 +788,7 @@ int iscsi_if_create_session_done(struct iscsi_cls_conn *conn)
959 * this will occur if the daemon is not up, so we just warn 788 * this will occur if the daemon is not up, so we just warn
960 * the user and when the daemon is restarted it will handle it 789 * the user and when the daemon is restarted it will handle it
961 */ 790 */
962 rc = iscsi_broadcast_skb(conn->z_pdu, skb, GFP_KERNEL); 791 rc = iscsi_broadcast_skb(skb, GFP_KERNEL);
963 if (rc < 0) 792 if (rc < 0)
964 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of " 793 dev_printk(KERN_ERR, &conn->dev, "Cannot notify userspace of "
965 "session creation event. Check iscsi daemon\n"); 794 "session creation event. Check iscsi daemon\n");
@@ -1278,9 +1107,6 @@ iscsi_if_rx(struct sock *sk, int len)
1278 err = iscsi_if_send_reply( 1107 err = iscsi_if_send_reply(
1279 NETLINK_CREDS(skb)->pid, nlh->nlmsg_seq, 1108 NETLINK_CREDS(skb)->pid, nlh->nlmsg_seq,
1280 nlh->nlmsg_type, 0, 0, ev, sizeof(*ev)); 1109 nlh->nlmsg_type, 0, 0, ev, sizeof(*ev));
1281 if (atomic_read(&z_reply->allocated) >=
1282 z_reply->hiwat)
1283 ev->iferror = -ENOMEM;
1284 } while (err < 0 && err != -ECONNREFUSED); 1110 } while (err < 0 && err != -ECONNREFUSED);
1285 skb_pull(skb, rlen); 1111 skb_pull(skb, rlen);
1286 } 1112 }
@@ -1584,32 +1410,6 @@ int iscsi_unregister_transport(struct iscsi_transport *tt)
1584} 1410}
1585EXPORT_SYMBOL_GPL(iscsi_unregister_transport); 1411EXPORT_SYMBOL_GPL(iscsi_unregister_transport);
1586 1412
1587static int
1588iscsi_rcv_nl_event(struct notifier_block *this, unsigned long event, void *ptr)
1589{
1590 struct netlink_notify *n = ptr;
1591
1592 if (event == NETLINK_URELEASE &&
1593 n->protocol == NETLINK_ISCSI && n->pid) {
1594 struct iscsi_cls_conn *conn;
1595 unsigned long flags;
1596
1597 mempool_zone_complete(z_reply);
1598 spin_lock_irqsave(&connlock, flags);
1599 list_for_each_entry(conn, &connlist, conn_list) {
1600 mempool_zone_complete(conn->z_error);
1601 mempool_zone_complete(conn->z_pdu);
1602 }
1603 spin_unlock_irqrestore(&connlock, flags);
1604 }
1605
1606 return NOTIFY_DONE;
1607}
1608
1609static struct notifier_block iscsi_nl_notifier = {
1610 .notifier_call = iscsi_rcv_nl_event,
1611};
1612
1613static __init int iscsi_transport_init(void) 1413static __init int iscsi_transport_init(void)
1614{ 1414{
1615 int err; 1415 int err;
@@ -1633,25 +1433,15 @@ static __init int iscsi_transport_init(void)
1633 if (err) 1433 if (err)
1634 goto unregister_conn_class; 1434 goto unregister_conn_class;
1635 1435
1636 err = netlink_register_notifier(&iscsi_nl_notifier);
1637 if (err)
1638 goto unregister_session_class;
1639
1640 nls = netlink_kernel_create(NETLINK_ISCSI, 1, iscsi_if_rx, 1436 nls = netlink_kernel_create(NETLINK_ISCSI, 1, iscsi_if_rx,
1641 THIS_MODULE); 1437 THIS_MODULE);
1642 if (!nls) { 1438 if (!nls) {
1643 err = -ENOBUFS; 1439 err = -ENOBUFS;
1644 goto unregister_notifier; 1440 goto unregister_session_class;
1645 } 1441 }
1646 1442
1647 z_reply = mempool_zone_init(Z_MAX_REPLY, 1443 return 0;
1648 NLMSG_SPACE(sizeof(struct iscsi_uevent)), Z_HIWAT_REPLY);
1649 if (z_reply)
1650 return 0;
1651 1444
1652 sock_release(nls->sk_socket);
1653unregister_notifier:
1654 netlink_unregister_notifier(&iscsi_nl_notifier);
1655unregister_session_class: 1445unregister_session_class:
1656 transport_class_unregister(&iscsi_session_class); 1446 transport_class_unregister(&iscsi_session_class);
1657unregister_conn_class: 1447unregister_conn_class:
@@ -1665,9 +1455,7 @@ unregister_transport_class:
1665 1455
1666static void __exit iscsi_transport_exit(void) 1456static void __exit iscsi_transport_exit(void)
1667{ 1457{
1668 mempool_zone_destroy(z_reply);
1669 sock_release(nls->sk_socket); 1458 sock_release(nls->sk_socket);
1670 netlink_unregister_notifier(&iscsi_nl_notifier);
1671 transport_class_unregister(&iscsi_connection_class); 1459 transport_class_unregister(&iscsi_connection_class);
1672 transport_class_unregister(&iscsi_session_class); 1460 transport_class_unregister(&iscsi_session_class);
1673 transport_class_unregister(&iscsi_host_class); 1461 transport_class_unregister(&iscsi_host_class);
diff --git a/include/scsi/scsi_transport_iscsi.h b/include/scsi/scsi_transport_iscsi.h
index 39e833260bd0..4b95c89c95c9 100644
--- a/include/scsi/scsi_transport_iscsi.h
+++ b/include/scsi/scsi_transport_iscsi.h
@@ -29,7 +29,6 @@
29struct scsi_transport_template; 29struct scsi_transport_template;
30struct iscsi_transport; 30struct iscsi_transport;
31struct Scsi_Host; 31struct Scsi_Host;
32struct mempool_zone;
33struct iscsi_cls_conn; 32struct iscsi_cls_conn;
34struct iscsi_conn; 33struct iscsi_conn;
35struct iscsi_cmd_task; 34struct iscsi_cmd_task;
@@ -157,9 +156,6 @@ struct iscsi_cls_conn {
157 156
158 int active; /* must be accessed with the connlock */ 157 int active; /* must be accessed with the connlock */
159 struct device dev; /* sysfs transport/container device */ 158 struct device dev; /* sysfs transport/container device */
160 struct mempool_zone *z_error;
161 struct mempool_zone *z_pdu;
162 struct list_head freequeue;
163}; 159};
164 160
165#define iscsi_dev_to_conn(_dev) \ 161#define iscsi_dev_to_conn(_dev) \