When a transport (e.g. iscsi_tcp, ib_iser) is unloaded, a notification
must be sent to userspace. This will allow the userspace code to release
all transport related resources.

Signed-off-by: Erez Zilber <[EMAIL PROTECTED]>
---
 drivers/scsi/scsi_transport_iscsi.c |   30 ++++++++++++++++++++++++++++++
 include/scsi/iscsi_if.h             |    7 ++++---
 2 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/drivers/scsi/scsi_transport_iscsi.c 
b/drivers/scsi/scsi_transport_iscsi.c
index cbd2b71..706c9b9 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1710,6 +1710,34 @@ free_priv:
 }
 EXPORT_SYMBOL_GPL(iscsi_register_transport);
 
+void iscsi_trans_error(struct iscsi_transport *tt)
+{
+       struct nlmsghdr *nlh;
+       struct sk_buff *skb;
+       struct iscsi_uevent *ev;
+       int len = NLMSG_SPACE(sizeof(*ev));
+       struct iscsi_internal *priv;
+
+       priv = iscsi_if_transport_lookup(tt);
+       if (!priv)
+               return;
+
+       skb = alloc_skb(len, GFP_ATOMIC);
+       if (!skb) {
+               printk(KERN_ERR "iscsi: gracefully ignored transport error\n");
+               return;
+       }
+
+       nlh = __nlmsg_put(skb, priv->daemon_pid, 0, 0, (len - sizeof(*nlh)), 0);
+       ev = NLMSG_DATA(nlh);
+       ev->transport_handle = iscsi_handle(tt);
+       ev->type = ISCSI_KEVENT_TRANS_ERROR;
+
+       iscsi_broadcast_skb(skb, GFP_ATOMIC);
+
+       printk(KERN_INFO "iscsi: detected transport error\n");
+}
+
 int iscsi_unregister_transport(struct iscsi_transport *tt)
 {
        struct iscsi_internal *priv;
@@ -1719,6 +1747,8 @@ int iscsi_unregister_transport(struct iscsi_transport *tt)
 
        mutex_lock(&rx_queue_mutex);
 
+       iscsi_trans_error(tt);
+
        priv = iscsi_if_transport_lookup(tt);
        BUG_ON (!priv);
 
diff --git a/include/scsi/iscsi_if.h b/include/scsi/iscsi_if.h
index 801a677..027eb96 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -56,9 +56,10 @@ enum iscsi_uevent_e {
        ISCSI_KEVENT_RECV_PDU           = KEVENT_BASE + 1,
        ISCSI_KEVENT_CONN_ERROR         = KEVENT_BASE + 2,
        ISCSI_KEVENT_IF_ERROR           = KEVENT_BASE + 3,
-       ISCSI_KEVENT_DESTROY_SESSION    = KEVENT_BASE + 4,
-       ISCSI_KEVENT_UNBIND_SESSION     = KEVENT_BASE + 5,
-       ISCSI_KEVENT_CREATE_SESSION     = KEVENT_BASE + 6,
+       ISCSI_KEVENT_TRANS_ERROR        = KEVENT_BASE + 4,
+       ISCSI_KEVENT_DESTROY_SESSION    = KEVENT_BASE + 5,
+       ISCSI_KEVENT_UNBIND_SESSION     = KEVENT_BASE + 6,
+       ISCSI_KEVENT_CREATE_SESSION     = KEVENT_BASE + 7,
 };
 
 enum iscsi_tgt_dscvr {
-- 
1.5.4.4



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To post to this group, send email to open-iscsi@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/open-iscsi
-~----------~----~----~----~------~----~------~--~---

Reply via email to