Re: [PATCH 2/2 v2] Notify when transport is unloaded

2008-04-26 Thread Mike Christie

Mike Christie wrote:
> Erez Zilber wrote:
>> 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,
>>  };
> 
> I have to make one more change to the patch. I guess you did not test 
> backward compat, and I just tested it :) We have to move 
> ISCSI_KEVENT_TRANS_ERROR to KEVENT_BASE + 7 and not take over 
> ISCSI_KEVENT_DESTROY_SESSION event number.
> 

Merged in 2f48598d72d48b0575459e9a9323e2cfc6334481 
(open-iscsi)/6a19b192b732b712c7ed011911ce103bc8ccad98 (linux-2.6.-iscsi)

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: [PATCH 2/2 v2] Notify when transport is unloaded

2008-04-26 Thread Mike Christie

Erez Zilber wrote:
> 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,
>  };

I have to make one more change to the patch. I guess you did not test 
backward compat, and I just tested it :) We have to move 
ISCSI_KEVENT_TRANS_ERROR to KEVENT_BASE + 7 and not take over 
ISCSI_KEVENT_DESTROY_SESSION event number.


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: [PATCH 2/2 v2] Notify when transport is unloaded

2008-04-23 Thread Erez Zilber

Mike Christie wrote:
> Mike Christie wrote:
>   
>> Resend it and then let's send it to James with the other iscsi patches 
>> for 2.6.26. Thanks.
>>
>> 
>
> See attached. I did it so we could get this out.
>   

I'm ok with it.

Thanks,
Erez


--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



Re: [PATCH 2/2 v2] Notify when transport is unloaded

2008-04-16 Thread Mike Christie
Mike Christie wrote:
> 
> Resend it and then let's send it to James with the other iscsi patches 
> for 2.6.26. Thanks.
> 

See attached. I did it so we could get this out.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---

>From d702f811401fd0d8ea7386b85d748420b235fd2e Mon Sep 17 00:00:00 2001
From: Mike Christie <[EMAIL PROTECTED]>
Date: Wed, 16 Apr 2008 11:40:27 -0500
Subject: [PATCH 4/4] iscsi class: Notify when transport is unloaded

>From Erez:
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.

Minor gfp cleanup by Mike Christie.

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

diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index ca7bb6f..ad48845 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -1671,6 +1671,32 @@ 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_KERNEL);
+	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_KERNEL);
+}
+
 int iscsi_unregister_transport(struct iscsi_transport *tt)
 {
 	struct iscsi_internal *priv;
@@ -1680,6 +1706,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 e19e584..d9b297a 100644
--- a/include/scsi/iscsi_if.h
+++ b/include/scsi/iscsi_if.h
@@ -55,9 +55,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.1



Re: [PATCH 2/2 v2] Notify when transport is unloaded

2008-04-16 Thread Mike Christie

Erez Zilber wrote:
> 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]>

Erez, some tiny comments.


> ---
>  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);


Since we only do this on module unload we should use GFP_KERNEL here.



> + 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);
> +

Use GFP_KERNEL here too.

> + printk(KERN_INFO "iscsi: detected transport error\n");

Again, since this is only used on module unload delete the error message 
since module unload is not an error and the log message is only going to 
cause confusion.

Resend it and then let's send it to James with the other iscsi patches 
for 2.6.26. Thanks.

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---