<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">2016-11-16 22:30 GMT+08:00 Soumya Koduri <span dir="ltr">&lt;<a href="mailto:skoduri@redhat.com" target="_blank">skoduri@redhat.com</a>&gt;</span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-"><br>
<br>
On 11/16/2016 07:38 PM, jin deng wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Thank you so much.Soumya,you make me more clear about the logic of the code.<br>
<br>
I used to wonder the code was to handle the last resolve case.However i<br>
followed<br>
<br>
the &quot;nfs3_fh_resolve_entry_hard&quot; and I thought it would get the ret ==<br>
-2 case and went<br>
<br>
into the &quot;nfs3_lookup_op&quot; branch,and finally call the<br>
&quot;nfs3_call_resume&quot;.Seems has<br>
<br>
no chance to call &quot;nfs3_fh_resolve_entry_lookup_<wbr>cbk&quot; because it was a LOOKUP<br>
<br>
operation.Am i wrong again? :-)<br>
</blockquote>
<br></span>
You are right :)...for LOOKUP fop, we go to &quot;nfs3_call_resume&quot; which is nfs3_lookup_resume and the callback is &quot;nfs3svc_lookup_cbk&quot; where in we are not updating cs-&gt;stbuf. But we seem to be constructing lookup reply (nfs3_lookup_reply) using &#39;buf&#39; directly returned for the child entry instead of using cs-&gt;stbuf. Maybe that&#39;s the reason it was working well till now.<br>
FYI - there was an issue in the lookup logic code path which we fixed as part of <a href="http://review.gluster.org/14911" rel="noreferrer" target="_blank">http://review.gluster.org/1491<wbr>1</a> . I will not be surprised if there are any more lurking around :)<br></blockquote><div>  </div><div> hmm...seems still has a problem.As the &quot;cs-&gt;hardresolved&quot; has been set to 1 in &quot;nfs3_fh_resolve_inode_hard&quot;.The &quot;nfs3_lookup_resume&quot; callback will not</div><div> get into the &quot;nfs3svc_lookup_cbk&quot;.Instead,the &quot;nfs3_lookup_resume&quot; will terminate at here as I thought:</div><div><br></div><div><div> if (cs-&gt;hardresolved) {</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>stat = NFS3_OK;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>nfs3_fh_build_child_fh (&amp;cs-&gt;parent, &amp;cs-&gt;stbuf, &amp;newfh);</div><div><span class="gmail-Apple-tab-span" style="white-space:pre">                </span>goto nfs3err;</div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> }        </span></div></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"><br></span></div><div><span class="gmail-Apple-tab-span" style="white-space:pre"> I wonder if this works fine because the NFS client always resolve the parent first, not very sure.</span></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
Thanks,<br>
Soumya<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">
<br>
<br>
<br>
2016-11-16 21:45 GMT+08:00 Soumya Koduri &lt;<a href="mailto:skoduri@redhat.com" target="_blank">skoduri@redhat.com</a><br></span>
&lt;mailto:<a href="mailto:skoduri@redhat.com" target="_blank">skoduri@redhat.com</a>&gt;&gt;:<span class="gmail-"><br>
<br>
<br>
<br>
    On 11/16/2016 06:38 PM, Pranith Kumar Karampuri wrote:<br>
<br>
        Added people who know nfs code.<br>
<br>
        On Wed, Nov 16, 2016 at 6:21 PM, jin deng<br>
        &lt;<a href="mailto:cheneydeng88@gmail.com" target="_blank">cheneydeng88@gmail.com</a> &lt;mailto:<a href="mailto:cheneydeng88@gmail.com" target="_blank">cheneydeng88@gmail.com</a><wbr>&gt;<br></span>
        &lt;mailto:<a href="mailto:cheneydeng88@gmail.com" target="_blank">cheneydeng88@gmail.com</a> &lt;mailto:<a href="mailto:cheneydeng88@gmail.com" target="_blank">cheneydeng88@gmail.com</a><wbr>&gt;&gt;&gt;<div><div class="gmail-h5"><br>
        wrote:<br>
<br>
            Hi all,<br>
                I&#39;m reading the code of 3.6.9 version and got a<br>
        question.And I&#39;m<br>
            not very familiar with the code,so I have to confirm it(I<br>
        checked<br>
            the master branch,it&#39;s same with 3.6.9).<br>
<br>
                The question is about the &#39;lookup&#39; operation of NFS.And<br>
        i&#39;m with<br>
            this code flow:<br>
<br>
                nfs3_lookup (nfs3.c) ==&gt; nfs3_fh_resolve_and_resume<br>
            ==&gt; nfs3_fh_resolve_root ==&gt; nfs3_fh_resolve_resume<br>
            ==&gt; nfs3_fh_resolve_entry ==&gt; nfs3_fh_resolve_entry_hard.<br>
<br>
            Now enter the &quot;nfs_entry_loc_fill&quot; and return with -1 which<br>
        means<br>
            the &quot;parent&quot; not found,so we have to do hard resolve about the<br>
            parent. After doing a hard resolve,we get into the callback<br>
            &quot;nfs3_fh_resolve_inode_lookup_<wbr>cbk&quot;.And the callback has the<br>
            following code:<br>
<br>
            &gt;&gt;&gt; memcpy (&amp;cs-&gt;stbuf, buf, sizeof(*buf));<br>
            &gt;&gt;&gt; memcpy (&amp;cs-&gt;postparent, buf, sizeof(*postparent))<br>
<br>
<br>
    This must had been done  (and required) in case if this was the last<br>
    entry(/inode) to be looked up<br>
<br>
<br>
            I think we&#39;ve just done a parent resolve,how could we assign the<br>
            parent result into the &quot;stbuf&quot; and &quot;postparent&quot;.The later<br>
        two should<br>
            be the information of the child file/directory.Do i made a<br>
            misunderstand?<br>
<br>
<br>
    In case if it was not the last entry we fall through below code in<br>
    &quot;nfs3_fh_resolve_inode_lookup_<wbr>cbk&quot; -<br>
<br>
            if (cs-&gt;resolventry)<br>
                    nfs3_fh_resolve_entry_hard (cs);<br>
<br>
    Callback is &quot;nfs3_fh_resolve_entry_lookup_<wbr>cbk()&quot; where in cs-&gt;stbuf<br>
    and cs-&gt;postparent get overridden with the values corresponding to<br>
    the child entry.<br>
<br>
    Thanks,<br>
    Soumya<br>
<br>
<br>
            Thanks advance for your help.<br>
<br>
            ______________________________<wbr>_________________<br>
            Gluster-users mailing list<br>
            <a href="mailto:Gluster-users@gluster.org" target="_blank">Gluster-users@gluster.org</a> &lt;mailto:<a href="mailto:Gluster-users@gluster.org" target="_blank">Gluster-users@gluster.<wbr>org</a>&gt;<br></div></div>
        &lt;mailto:<a href="mailto:Gluster-users@gluster.org" target="_blank">Gluster-users@gluster.<wbr>org</a><span class="gmail-"><br>
        &lt;mailto:<a href="mailto:Gluster-users@gluster.org" target="_blank">Gluster-users@gluster.<wbr>org</a>&gt;&gt;<br>
            <a href="http://www.gluster.org/mailman/listinfo/gluster-users" rel="noreferrer" target="_blank">http://www.gluster.org/mailman<wbr>/listinfo/gluster-users</a><br>
        &lt;<a href="http://www.gluster.org/mailman/listinfo/gluster-users" rel="noreferrer" target="_blank">http://www.gluster.org/mailma<wbr>n/listinfo/gluster-users</a>&gt;<br>
            &lt;<a href="http://www.gluster.org/mailman/listinfo/gluster-users" rel="noreferrer" target="_blank">http://www.gluster.org/mailma<wbr>n/listinfo/gluster-users</a><br>
        &lt;<a href="http://www.gluster.org/mailman/listinfo/gluster-users" rel="noreferrer" target="_blank">http://www.gluster.org/mailma<wbr>n/listinfo/gluster-users</a>&gt;&gt;<br>
<br>
<br>
<br>
<br>
        --<br>
        Pranith<br>
<br>
<br>
</span></blockquote>
</blockquote></div><br></div></div>