public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [patch] NetworkPkg: Fix issue the iSCSI client can not send reset packet.
@ 2017-04-28  6:41 Zhang Lubo
  2017-04-28  8:26 ` Wu, Jiaxin
  2017-05-03  2:56 ` Ye, Ting
  0 siblings, 2 replies; 3+ messages in thread
From: Zhang Lubo @ 2017-04-28  6:41 UTC (permalink / raw)
  To: edk2-devel; +Cc: Wu Jiaxin, Ye Ting, Fu Siyuan

if we already established a iSCSI connection from initiator to target
based on IPv4 stack, after using reconnect -r command, we can not rebuild
the session with the windows target, since the server thought the session
is still exist.  This issue is caused by wrong place of acquire ownership of
sock lock which lead the iSCSI can not reset the connection correctly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
---
 NetworkPkg/TcpDxe/SockInterface.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/NetworkPkg/TcpDxe/SockInterface.c b/NetworkPkg/TcpDxe/SockInterface.c
index b4ba40a..0248cdf 100644
--- a/NetworkPkg/TcpDxe/SockInterface.c
+++ b/NetworkPkg/TcpDxe/SockInterface.c
@@ -167,22 +167,10 @@ SockDestroyChild (
   ProtoData = (TCP_PROTO_DATA *) Sock->ProtoReserved;
   Tcb       = ProtoData->TcpPcb;
 
   ASSERT (Tcb != NULL);
 
-  Status            = EfiAcquireLockOrFail (&(Sock->Lock));
-  if (EFI_ERROR (Status)) {
-
-    DEBUG (
-      (EFI_D_ERROR,
-      "SockDestroyChild: Get the lock to access socket failed with %r\n",
-      Status)
-      );
-
-    return EFI_ACCESS_DENIED;
-  }
-
   //
   // Close the IP protocol.
   //
   gBS->CloseProtocol (
          Tcb->IpInfo->ChildHandle,
@@ -224,10 +212,23 @@ SockDestroyChild (
         TcpProtocolGuid,
         SockProtocol,
         NULL
         );
 
+
+  Status            = EfiAcquireLockOrFail (&(Sock->Lock));
+  if (EFI_ERROR (Status)) {
+
+    DEBUG (
+      (EFI_D_ERROR,
+      "SockDestroyChild: Get the lock to access socket failed with %r\n",
+      Status)
+      );
+
+    return EFI_ACCESS_DENIED;
+  }
+
   //
   // force protocol layer to detach the PCB
   //
   Status = Sock->ProtoHandler (Sock, SOCK_DETACH, NULL);
 
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] NetworkPkg: Fix issue the iSCSI client can not send reset packet.
  2017-04-28  6:41 [patch] NetworkPkg: Fix issue the iSCSI client can not send reset packet Zhang Lubo
@ 2017-04-28  8:26 ` Wu, Jiaxin
  2017-05-03  2:56 ` Ye, Ting
  1 sibling, 0 replies; 3+ messages in thread
From: Wu, Jiaxin @ 2017-04-28  8:26 UTC (permalink / raw)
  To: Zhang, Lubo, edk2-devel@lists.01.org; +Cc: Ye, Ting, Fu, Siyuan

Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>


Thanks,
Jiaxin

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Zhang Lubo
> Sent: Friday, April 28, 2017 2:42 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin
> <jiaxin.wu@intel.com>
> Subject: [edk2] [patch] NetworkPkg: Fix issue the iSCSI client can not send reset
> packet.
> 
> if we already established a iSCSI connection from initiator to target
> based on IPv4 stack, after using reconnect -r command, we can not rebuild
> the session with the windows target, since the server thought the session
> is still exist.  This issue is caused by wrong place of acquire ownership of
> sock lock which lead the iSCSI can not reset the connection correctly.
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
> Cc: Wu Jiaxin <jiaxin.wu@intel.com>
> Cc: Ye Ting <ting.ye@intel.com>
> Cc: Fu Siyuan <siyuan.fu@intel.com>
> ---
>  NetworkPkg/TcpDxe/SockInterface.c | 25 +++++++++++++------------
>  1 file changed, 13 insertions(+), 12 deletions(-)
> 
> diff --git a/NetworkPkg/TcpDxe/SockInterface.c
> b/NetworkPkg/TcpDxe/SockInterface.c
> index b4ba40a..0248cdf 100644
> --- a/NetworkPkg/TcpDxe/SockInterface.c
> +++ b/NetworkPkg/TcpDxe/SockInterface.c
> @@ -167,22 +167,10 @@ SockDestroyChild (
>    ProtoData = (TCP_PROTO_DATA *) Sock->ProtoReserved;
>    Tcb       = ProtoData->TcpPcb;
> 
>    ASSERT (Tcb != NULL);
> 
> -  Status            = EfiAcquireLockOrFail (&(Sock->Lock));
> -  if (EFI_ERROR (Status)) {
> -
> -    DEBUG (
> -      (EFI_D_ERROR,
> -      "SockDestroyChild: Get the lock to access socket failed with %r\n",
> -      Status)
> -      );
> -
> -    return EFI_ACCESS_DENIED;
> -  }
> -
>    //
>    // Close the IP protocol.
>    //
>    gBS->CloseProtocol (
>           Tcb->IpInfo->ChildHandle,
> @@ -224,10 +212,23 @@ SockDestroyChild (
>          TcpProtocolGuid,
>          SockProtocol,
>          NULL
>          );
> 
> +
> +  Status            = EfiAcquireLockOrFail (&(Sock->Lock));
> +  if (EFI_ERROR (Status)) {
> +
> +    DEBUG (
> +      (EFI_D_ERROR,
> +      "SockDestroyChild: Get the lock to access socket failed with %r\n",
> +      Status)
> +      );
> +
> +    return EFI_ACCESS_DENIED;
> +  }
> +
>    //
>    // force protocol layer to detach the PCB
>    //
>    Status = Sock->ProtoHandler (Sock, SOCK_DETACH, NULL);
> 
> --
> 1.9.5.msysgit.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] NetworkPkg: Fix issue the iSCSI client can not send reset packet.
  2017-04-28  6:41 [patch] NetworkPkg: Fix issue the iSCSI client can not send reset packet Zhang Lubo
  2017-04-28  8:26 ` Wu, Jiaxin
@ 2017-05-03  2:56 ` Ye, Ting
  1 sibling, 0 replies; 3+ messages in thread
From: Ye, Ting @ 2017-05-03  2:56 UTC (permalink / raw)
  To: Zhang, Lubo, edk2-devel@lists.01.org; +Cc: Fu, Siyuan, Wu, Jiaxin

Reviewed-by: Ye Ting <ting.ye@intel.com> 

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Zhang Lubo
Sent: Friday, April 28, 2017 2:42 PM
To: edk2-devel@lists.01.org
Cc: Ye, Ting <ting.ye@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>
Subject: [edk2] [patch] NetworkPkg: Fix issue the iSCSI client can not send reset packet.

if we already established a iSCSI connection from initiator to target based on IPv4 stack, after using reconnect -r command, we can not rebuild the session with the windows target, since the server thought the session is still exist.  This issue is caused by wrong place of acquire ownership of sock lock which lead the iSCSI can not reset the connection correctly.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
---
 NetworkPkg/TcpDxe/SockInterface.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)

diff --git a/NetworkPkg/TcpDxe/SockInterface.c b/NetworkPkg/TcpDxe/SockInterface.c
index b4ba40a..0248cdf 100644
--- a/NetworkPkg/TcpDxe/SockInterface.c
+++ b/NetworkPkg/TcpDxe/SockInterface.c
@@ -167,22 +167,10 @@ SockDestroyChild (
   ProtoData = (TCP_PROTO_DATA *) Sock->ProtoReserved;
   Tcb       = ProtoData->TcpPcb;
 
   ASSERT (Tcb != NULL);
 
-  Status            = EfiAcquireLockOrFail (&(Sock->Lock));
-  if (EFI_ERROR (Status)) {
-
-    DEBUG (
-      (EFI_D_ERROR,
-      "SockDestroyChild: Get the lock to access socket failed with %r\n",
-      Status)
-      );
-
-    return EFI_ACCESS_DENIED;
-  }
-
   //
   // Close the IP protocol.
   //
   gBS->CloseProtocol (
          Tcb->IpInfo->ChildHandle,
@@ -224,10 +212,23 @@ SockDestroyChild (
         TcpProtocolGuid,
         SockProtocol,
         NULL
         );
 
+
+  Status            = EfiAcquireLockOrFail (&(Sock->Lock));
+  if (EFI_ERROR (Status)) {
+
+    DEBUG (
+      (EFI_D_ERROR,
+      "SockDestroyChild: Get the lock to access socket failed with %r\n",
+      Status)
+      );
+
+    return EFI_ACCESS_DENIED;
+  }
+
   //
   // force protocol layer to detach the PCB
   //
   Status = Sock->ProtoHandler (Sock, SOCK_DETACH, NULL);
 
--
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-05-03  2:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-28  6:41 [patch] NetworkPkg: Fix issue the iSCSI client can not send reset packet Zhang Lubo
2017-04-28  8:26 ` Wu, Jiaxin
2017-05-03  2:56 ` Ye, Ting

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox