<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 22, 2016 at 5:50 AM, Sachin Pandit <span dir="ltr">&lt;<a href="mailto:spandit@commvault.com" target="_blank">spandit@commvault.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Hey Pranith, I am good, I hope you are doing good too.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Please find the comments inline.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> Pranith Kumar Karampuri [mailto:<a href="mailto:pkarampu@redhat.com" target="_blank">pkarampu@redhat.com</a>]
<br>
<b>Sent:</b> Tuesday, June 21, 2016 5:58 AM<br>
<b>To:</b> Sachin Pandit &lt;<a href="mailto:spandit@commvault.com" target="_blank">spandit@commvault.com</a>&gt;<br>
<b>Cc:</b> <a href="mailto:gluster-devel@gluster.org" target="_blank">gluster-devel@gluster.org</a><br>
<b>Subject:</b> Re: [Gluster-devel] Reduce memcpy in glfs read and write<u></u><u></u></span></p>
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<div><span class="">
<div>
<p class="MsoNormal">Hey!!<u></u><u></u></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt">       Hope you are doing good. I took a look at the bt. So when flush comes write-behind has to flush all the writes down. I see the following frame hung in iob_unref:<br>
Thread 7 (Thread 0x7fa601a30700 (LWP 16218)): <br>
#0  0x00007fa60cc55225 in pthread_spin_lock () from /lib64/libpthread.so.0  &lt;&lt;---- Does it always hang there?<span style="color:#1f497d"><u></u><u></u></span></p>
</span><p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">---------------------------------<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">&gt;&gt;It does always hang here.<u></u><u></u></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span style="color:#1f497d">---------------------------------</span><span class=""><br>
#1  0x00007fa60e1f373e in iobref_unref (iobref=0x19dc7e0) at iobuf.c:907 <br>
#2  0x00007fa60e246fb2 in args_wipe (args=0x19e70ec) at default-args.c:1593 <br>
#3  0x00007fa60e1ea534 in call_stub_wipe_args (stub=0x19e709c) at call-stub.c:2466
<br>
#4  0x00007fa60e1ea5de in call_stub_destroy (stub=0x19e709c) at call-stub.c:2482<u></u><u></u></span></p>
</div><span class="">
<p class="MsoNormal">Is this on top of master branch? It seems like we missed an unlock of the spin-lock or the iobref has junk value which gives the feeling that it is in locked state (May be double free?). Do you have any extra patches you have in your repo
 which make changes in iobuf?<u></u><u></u></p>
</span><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">----------------------------------<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">&gt;&gt;I have implemented a method to reduce memcpy in libgfapi (My patch is on top of master branch), by making use of buffer from iobuf pool and passing the buffer
 to application. However, I have not made any changes in iobuf core feature. I don’t  think double free is happening anywhere in the code (I did check this using logs)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">     Method that I have implemented:<u></u><u></u></span></p>
<p><u></u><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><span>1)<span style="font:7.0pt &quot;Times New Roman&quot;">     
</span></span></span><u></u><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Application asks for a buffer of specific size, and the buffer is allocated from the iobuf pool.<u></u><u></u></span></p>
<p><u></u><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><span>2)<span style="font:7.0pt &quot;Times New Roman&quot;">     
</span></span></span><u></u><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Buffer is passed on to application, and the application writes the data into that buffer.
<u></u><u></u></span></p>
<p><u></u><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><span>3)<span style="font:7.0pt &quot;Times New Roman&quot;">     
</span></span></span><u></u><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Buffer with data in it is passed from application to libgfapi and the underlying translators (no memcpy in glfs_write)<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">I have couple of questions, and observations:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Observations:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">------------------<u></u><u></u></span></p>
<p style="margin-left:38.25pt">
<u></u><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><span>1)<span style="font:7.0pt &quot;Times New Roman&quot;">     
</span></span></span><u></u><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">For every write if I get a fresh buffer then I don’t see any problem. All the writes are going through.<u></u><u></u></span></p>
<p style="margin-left:38.25pt">
<u></u><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><span>2)<span style="font:7.0pt &quot;Times New Roman&quot;">     
</span></span></span><u></u><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">If I try to make use of buffer for consecutive writes, then I am seeing the hang in flush.
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Question1: Is it fine if I reuse the buffer for consecutive writes??<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Question2: Is it always ensured that the data is written to the file when I get a response from syncop_writev.</span></p></div></div></div></blockquote><div><br></div><div>Will it be possible to share the patch on master and a test program which can recreate this issue?<br> <br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div link="blue" vlink="purple" lang="EN-US"><div><div><p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Thanks,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">Sachin Pandit.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d"><u></u> <u></u></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1f497d">----------------------------------<u></u><u></u></span></p><div><div class="h5">
<p class="MsoNormal"><u></u> <u></u></p>
<div>
<p class="MsoNormal">On Tue, Jun 21, 2016 at 4:07 AM, Sachin Pandit &lt;<a href="mailto:spandit@commvault.com" target="_blank">spandit@commvault.com</a>&gt; wrote:<u></u><u></u></p>
<blockquote style="border:none;border-left:solid #cccccc 1.0pt;padding:0in 0in 0in 6.0pt;margin-left:4.8pt;margin-right:0in">
<div>
<div>
<p class="MsoNormal">Hi all,<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">I bid adieu to you all with the hope of crossing path again, and the time has come rather quickly. It feels great to work on GlusterFS again.<u></u><u></u></p>
<p class="MsoNormal">               
<u></u><u></u></p>
<p class="MsoNormal">Currently we are trying to write data backed up by Commvault Simpana to glusterfs volume (Disperse volume). To improve the performance, I have implemented the proposal put forward
 my Rafi  K C [1]. I have some questions regarding libgfapi and iobuf pool. <u></u>
<u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">To reduce an extra level of copy in glfs read and write, I have implemented few APIs to request a buffer (similar to the one represented in  [1]) from iobuf pool which can be used
 by the application to write data to. With this implementation, when I try to reuse the buffer for consecutive writes, I could see a hang in syncop_flush of glfs_close (BT of the hang can be found in [2]). I wanted to know if reusing the buffer is recommended.
 If not, do we need to request buffer for each writes?<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Setup : Distributed-Disperse ( 4 * (2+1)). Bricks scattered over 3 nodes.<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">[1]
<a href="http://www.gluster.org/pipermail/gluster-devel/2015-February/043966.html" target="_blank">
http://www.gluster.org/pipermail/gluster-devel/2015-February/043966.html</a><u></u><u></u></p>
<p class="MsoNormal">[2] Attached file -  bt.txt<u></u><u></u></p>
<p class="MsoNormal"> <u></u><u></u></p>
<p class="MsoNormal">Thanks &amp; Regards,<u></u><u></u></p>
<p class="MsoNormal">Sachin Pandit.<u></u><u></u></p>
</div>
</div>
<pre><u></u> <u></u></pre>
<pre>***************************Legal Disclaimer***************************<u></u><u></u></pre>
<pre>&quot;This communication may contain confidential and privileged material for the<u></u><u></u></pre>
<pre>sole use of the intended recipient. Any unauthorized review, use or distribution<u></u><u></u></pre>
<pre>by others is strictly prohibited. If you have received the message by mistake,<u></u><u></u></pre>
<pre>please advise the sender by reply email and delete the message. Thank you.&quot;<u></u><u></u></pre>
<pre>**********************************************************************<u></u><u></u></pre>
<p class="MsoNormal"><br>
_______________________________________________<br>
Gluster-devel mailing list<br>
<a href="mailto:Gluster-devel@gluster.org" target="_blank">Gluster-devel@gluster.org</a><br>
<a href="http://www.gluster.org/mailman/listinfo/gluster-devel" target="_blank">http://www.gluster.org/mailman/listinfo/gluster-devel</a><u></u><u></u></p>
</blockquote>
</div>
<p class="MsoNormal"><br>
<br clear="all">
<br>
-- <u></u><u></u></p>
<div>
<div>
<p class="MsoNormal">Pranith<u></u><u></u></p>
</div>
</div>
</div></div></div>
</div>
</div><div class="HOEnZb"><div class="h5">



<pre>***************************Legal Disclaimer***************************
&quot;This communication may contain confidential and privileged material for the
sole use of the intended recipient. Any unauthorized review, use or distribution
by others is strictly prohibited. If you have received the message by mistake,
please advise the sender by reply email and delete the message. Thank you.&quot;
**********************************************************************</pre>
</div></div></blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr">Pranith<br></div></div>
</div></div>