<div dir="ltr">Hi Sreekanth,<div><br></div><div>Thanks for the explanation. The CreateGuid cache that you described is not mentioned in the Abstract Data Model section of MS-SMB2. It will be good if its documented. <br></div><div><br></div><div>Regards,</div><div>anubhav</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Nov 27, 2014 at 10:13 AM, Sreekanth Nadendla <span dir="ltr"><<a href="mailto:srenaden@microsoft.com" target="_blank">srenaden@microsoft.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-US" link="#0563C1" vlink="#954F72">
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif"">Hello Anubhav,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif"">Upon further analysis today, we have found that the observed behavior is a result of race condition with respect to oplock processing. Below are additional details. This explains the behavior
 you are seeing.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><u><span style="font-family:"Calibri","sans-serif"">Some background about CreateGUID.<u></u><u></u></span></u></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif"">CreateGuid is used to allow a client to replay an open for which it has not seen the response. The idea is when the client does not know the SMB2 FID, it can’t use the durable v1 form of
 reconnecting to the Open. Client is expected to issue a replay, but there is no way to refer to a previous open.  In this situation, by allowing the client to provide a GUID that identifies an open, they can refer to it.  So for this purpose after processing
 a create, the server maintains this value in a cache. This cache is maintained for creates that we are not sure the client has seen the response for.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif"">When the client issues a subsequent request with actual file id, it has now acknowledged that it knows the SMB2 file id (i.e. it received the create response) so a recovery of a handle will
 now be a <i>resume</i> and NOT a <i>replay</i>.  This means that caching the create by CreateGuid is no longer necessary, and as such, when Server receives a request using the SMB2 file id, it removes it from the cache as it is no longer needed.  
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif"">oplock break acknowledgement serves as a request using the SMB2 file id.  As such there is a race occurring here between when the initial operation processes and the result that is returned.  
 In the case where DUPLICATE_OBJECTID is returned, we see the response went out at 54.426658 and the oplock break ack was received at 54.4279230.   (i.e. oplock ack is after failure, and thus the entry was still in the caching table at create complete.)   In
 the case of success we see oplock break ack arrived at 20.52079 and create response was sent at 20.52274.  So oplock break ACK removed the createGUID value from server’s cache  and hence no
<em><span style="font-family:"Calibri","sans-serif"">STATUS_DUPLICATE_OBJECTID.</span></em><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif"">Note that both REPLAY in the header and the CreateGUID in the create context are properties of the 3.x dialect<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif"">In a normal usecase scenario for 3.x dialect, the client is expected to set
<em><span style="font-family:"Calibri","sans-serif"">SMB2_FLAGS_REPLAY_OPERATION bit with second create Request.</span></em><u></u><u></u></span></p><span class="">
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif"">Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif"">Sreekanth Nadendla<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif"">Microsoft Windows Open Specifications<u></u><u></u></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
</span><div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> Sreekanth Nadendla
<br>
<b>Sent:</b> Wednesday, November 26, 2014 11:22 AM<span class=""><br>
<b>To:</b> 'Anubhav Rakshit'<br>
<b>Cc:</b> '<a href="mailto:cifs-protocol@samba.org" target="_blank">cifs-protocol@samba.org</a>'; MSSolve Case Email<br>
</span><b>Subject:</b> RE: 114111212024789 Handling SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 Create Context<u></u><u></u></span></p>
</div>
</div><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hello Anubhav, can you tell me if this issue is blocking your implementation ? From our attempts to repro, we find that it does not reproduce at will and is
 timing dependent. Can you state if this reproduces reliably all the time at your end ? Would you be able to share your setup details ?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Sreekanth Nadendla<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Microsoft Windows Open Specifications<u></u><u></u></span></p>
</div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<div>
<div style="border:none;border-top:solid #e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> Sreekanth Nadendla
<br>
<b>Sent:</b> Wednesday, November 12, 2014 4:52 PM<br>
<b>To:</b> Anubhav Rakshit<br>
<b>Cc:</b> <a href="mailto:cifs-protocol@samba.org" target="_blank">cifs-protocol@samba.org</a>; MSSolve Case Email<br>
<b>Subject:</b> 114111212024789 Handling SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 Create Context<u></u><u></u></span></p>
</div>
</div>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif"">Hello Anubhav,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif"">I am the engineer who will be working with you on this issue. I am currently researching the problem and will provide you with an update soon. Thank you for your patience.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif""><u></u> <u></u></span></p>
<div>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif"">Regards,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif"">Sreekanth Nadendla<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Calibri","sans-serif"">Microsoft Windows Open Specifications<u></u><u></u></span></p>
</div>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></b></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif"">From:</span></b><span style="font-size:11.0pt;font-family:"Calibri","sans-serif""> Anubhav Rakshit [<a href="mailto:anubhav.rakshit@gmail.com" target="_blank">mailto:anubhav.rakshit@gmail.com</a>]
<br>
<b>Sent:</b> Wednesday, November 12, 2014 12:58 AM<br>
<b>To:</b> Interoperability Documentation Help<br>
<b>Cc:</b> <a href="mailto:cifs-protocol@samba.org" target="_blank">cifs-protocol@samba.org</a><br>
<b>Subject:</b> Handling SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 Create Context<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p style="margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.5pt">
<span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black">With reference to MS-SMB2  v20140502 section 3.3.5.9.10 I am trying to test the following scenario as mentioned in the specs:<u></u><u></u></span></p>
<p style="margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.5pt">
<em><span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black">If an Open is found and the SMB2_FLAGS_REPLAY_OPERATION bit is not set in the SMB2 header,</span></em><span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black"><br>
<em><span style="font-family:"Verdana","sans-serif"">the server MUST fail the request with STATUS_DUPLICATE_OBJECTID. </span></em><u></u><u></u></span></p>
<p style="margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.5pt">
<span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black"><u></u> <u></u></span></p>
<p style="margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.5pt">
<span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black">I have two test cases. In one of the test cases, I get the expected error STATUS_DUPLICATE_OBJECTID and in the other I get STATUS_SUCCESS.<u></u><u></u></span></p>
<p style="margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.5pt">
<span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black"><u></u> <u></u></span></p>
<p style="margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.5pt">
<span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black">Case 1:<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in;line-height:13.5pt">
<u></u><span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black"><span>1.<span style="font:7.0pt "Times New Roman"">   
</span></span></span><u></u><span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black">Send SMB2_CREATE request with SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 context to server. This call succeeds.<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in;line-height:13.5pt">
<u></u><span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black"><span>2.<span style="font:7.0pt "Times New Roman"">   
</span></span></span><u></u><span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black">Re-send the exact same request as above and the server fails the request with STATUS_DUPLICATE_OBJECTID. Also the server sends an Oplock break notification.<u></u><u></u></span></p>
<p style="margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.5pt">
<span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black"></span><span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black">Case 2:<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in;line-height:13.5pt">
<u></u><span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black"><span>1.<span style="font:7.0pt "Times New Roman"">   
</span></span></span><u></u><span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black">Send SMB2_CREATE request with SMB2_CREATE_DURABLE_HANDLE_REQUEST_V2 context to server. This call succeeds.<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in;line-height:13.5pt">
<u></u><span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black"><span>2.<span style="font:7.0pt "Times New Roman"">   
</span></span></span><u></u><span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black">Send SMB2_QUERY_INFO on the above File Handle. This call succeeds.<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-left:.5in;line-height:13.5pt">
<u></u><span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black"><span>3.<span style="font:7.0pt "Times New Roman"">   
</span></span></span><u></u><span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black">Re-send the exact same request as 1. We see an Oplock break notification triggered. Also the SMB2_CREATE succeeds.<u></u><u></u></span></p>
<p style="margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.5pt">
<span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black">According to the specs SMB2_CREATE in 3. should have failed with STATUS_DUPLICATE_OBJECTID. Can you please explain why the server behaves differently in this case?<u></u><u></u></span></p>
<p style="margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.5pt">
<span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black"><u></u> <u></u></span></p>
<p style="margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.5pt">
<span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black">I am also attaching the Message Analyzer captures for both the cases. For Case 1. look at "duplicate_objectid_pass" Frame 3444. For Case 2. look at "duplicate_objectid_fail" Frame
 45.<u></u><u></u></span></p>
<p style="margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.5pt">
<span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black"><u></u> <u></u></span></p>
<p style="margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.5pt">
<span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black">Thanks,<u></u><u></u></span></p>
<p style="margin-right:0in;margin-bottom:12.0pt;margin-left:0in;line-height:13.5pt">
<span style="font-size:9.0pt;font-family:"Verdana","sans-serif";color:black">anubhav<u></u><u></u></span></p>
</div>
</div></div></div>
</div>

</blockquote></div><br></div>