From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 2BA812195406F for ; Thu, 27 Apr 2017 23:40:57 -0700 (PDT) Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Apr 2017 23:40:56 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,387,1488873600"; d="scan'208";a="81666345" Received: from shwdeopenpsi116.ccr.corp.intel.com ([10.239.9.5]) by orsmga004.jf.intel.com with ESMTP; 27 Apr 2017 23:40:55 -0700 From: Zhang Lubo To: edk2-devel@lists.01.org Cc: Wu Jiaxin , Ye Ting , Fu Siyuan Date: Fri, 28 Apr 2017 14:40:49 +0800 Message-Id: <1493361649-8096-1-git-send-email-lubo.zhang@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [patch] MdeModulePkg: Fix issue the iSCSI client can not send reset packet correctly. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 06:40:57 -0000 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 Cc: Wu Jiaxin Cc: Ye Ting Cc: Fu Siyuan --- MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c index f8b535c..bca4b02 100644 --- a/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c +++ b/MdeModulePkg/Universal/Network/Tcp4Dxe/SockInterface.c @@ -160,19 +160,10 @@ SockDestroyChild ( ProtoData = (TCP4_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, @@ -212,10 +203,19 @@ SockDestroyChild ( &gEfiTcp4ProtocolGuid, 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