<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:宋体;
        panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@宋体";
        panose-1:2 1 6 0 3 1 1 1 1 1;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:宋体;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.im
        {mso-style-name:im;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ZH-CN" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">I suppose there seems a defect on mdc_writev_cbk &nbsp;and mdc_fstat<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">Let’s assume in 2 timestamp which called write and fstat operation in application:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">T0: &nbsp;write (process a)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">T1: read (process b) with the data of T0 of process a.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">T2: fstat&nbsp;&nbsp; (process c)<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">In my view, mdc_write is non-block operation and have some lock to protect in afr xlator, &nbsp;because mdc_fstat not check the lock in AFR xaltor, so
 mdc_writev_cbk which called “mdc_inode_iatt_set_validate” maybe later than mdc_fstat.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">Such like<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">T3: fstat result of T2 &nbsp;without the “mdc_inode_iatt_set_validate” of T0 when stat-prefetch options is on.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">T4: “mdc_inode_iatt_set_validate” is called of T0 in mdc_writev_cbk.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">Lets’ assume T0&lt;T1&lt;T2&lt;T3&lt;T4, is the above assumption is reasonable case when in multi-process environment and the load of CPU is high?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">If it is reasonable, then issue of “tail issue” will be happened.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">So maybe a fix suggestion is on mdc_fstat operation , we should add an operation to check whether the writev operation is ongoing or not, if write-operation
 is ongoing, should goto uncached label in mdc_fstat function.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">Could you please confirm the above assumption and suggestion?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">Thanks &amp; Best Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">George<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> Lian, George (Nokia - CN/Hangzhou)
<br>
<b>Sent:</b> Monday, October 31, 2016 4:25 PM<br>
<b>To:</b> Pranith Kumar Karampuri &lt;pkarampu@redhat.com&gt;; Raghavendra Gowdappa &lt;rgowdapp@redhat.com&gt;<br>
<b>Cc:</b> I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX_GMS &lt;I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com&gt;; Zhang, Bingxuan (Nokia - CN/Hangzhou) &lt;bingxuan.zhang@nokia.com&gt;; Gluster-devel@gluster.org; Zizka, Jan (Nokia - CZ/Prague) &lt;jan.zizka@nokia.com&gt;<br>
<b>Subject:</b> RE: [Gluster-devel] Issue about the size of fstat is less than the really size of the syslog file<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">How can we enable debug.trace so that we can inspect the debug data on different xlator?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">I just set “debug.trace on” and “debug.log-file yes” seems not work now.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">And one more update for this issue, if we set performance.stat-prefetch to off, the issue will not be occurred. (our previous test maybe not correct</span><span lang="EN-US" style="font-size:10.5pt;font-family:Wingdings;color:#1F497D">J</span><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">
 )<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">Thanks &amp; Best Regards,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D">George<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US" style="font-size:10.5pt;font-family:&quot;Calibri&quot;,sans-serif;color:#1F497D"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif">From:</span></b><span lang="EN-US" style="font-size:11.0pt;font-family:&quot;Calibri&quot;,sans-serif"> Pranith Kumar Karampuri [<a href="mailto:pkarampu@redhat.com">mailto:pkarampu@redhat.com</a>]
<br>
<b>Sent:</b> Friday, October 28, 2016 2:39 PM<br>
<b>To:</b> Lian, George (Nokia - CN/Hangzhou) &lt;<a href="mailto:george.lian@nokia.com">george.lian@nokia.com</a>&gt;<br>
<b>Cc:</b> Raghavendra Gowdappa &lt;<a href="mailto:rgowdapp@redhat.com">rgowdapp@redhat.com</a>&gt;; I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX_GMS &lt;<a href="mailto:I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com">I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com</a>&gt;; Zhang,
 Bingxuan (Nokia - CN/Hangzhou) &lt;<a href="mailto:bingxuan.zhang@nokia.com">bingxuan.zhang@nokia.com</a>&gt;;
<a href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a>; Zizka, Jan (Nokia - CZ/Prague) &lt;<a href="mailto:jan.zizka@nokia.com">jan.zizka@nokia.com</a>&gt;<br>
<b>Subject:</b> Re: [Gluster-devel] Issue about the size of fstat is less than the really size of the syslog file<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">hi George,<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; It would help if we can identify the bare minimum xlators which are contributing to the issue like Raghavendra was mentioning earlier. We were wondering if it is possible for you to help us in identifying the issue
 by running the workload on a modified setup? We can suggest testing out using custom volfiles so that we can slowly build the graph which could be causing this issue. We would like you guys to try out this problem with just posix-xlator and fuse and nothing
 else.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<div>
<p class="MsoNormal"><span lang="EN-US">On Thu, Oct 27, 2016 at 1:40 PM, Lian, George (Nokia - CN/Hangzhou) &lt;<a href="mailto:george.lian@nokia.com" target="_blank">george.lian@nokia.com</a>&gt; wrote:<o:p></o:p></span></p>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
<p class="MsoNormal"><span lang="EN-US">Hi, Raghavendra,<br>
<br>
Could you please give some suggestion for this issue? we try to find the clue for this issue for a long time, but it has no progress:(<br>
<br>
<span class="im">Thanks &amp; Best Regards,</span><br>
<span class="im">George</span><br>
<br>
<span class="im">-----Original Message-----</span><br>
<span class="im">From: Lian, George (Nokia - CN/Hangzhou)</span><br>
<span class="im">Sent: Wednesday, October 19, 2016 4:40 PM</span><br>
<span class="im">To: 'Raghavendra Gowdappa' &lt;<a href="mailto:rgowdapp@redhat.com">rgowdapp@redhat.com</a>&gt;</span><br>
<span class="im">Cc: <a href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a>; I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX_GMS &lt;<a href="mailto:I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com">I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com</a>&gt;; Zhang,
 Bingxuan (Nokia - CN/Hangzhou) &lt;<a href="mailto:bingxuan.zhang@nokia.com">bingxuan.zhang@nokia.com</a>&gt;; Zizka, Jan (Nokia - CZ/Prague) &lt;<a href="mailto:jan.zizka@nokia.com">jan.zizka@nokia.com</a>&gt;</span><br>
<span class="im">Subject: RE: [Gluster-devel] Issue about the size of fstat is less than the really size of the syslog file</span><br>
<br>
<span class="im">Hi, Raghavendra</span><br>
<br>
<span class="im">Just now, we test it with glusterfs log with debug-level &quot;TRACE&quot;, and let some application trigger &quot;glusterfs&quot; produce large log, in that case, when we set write-behind and stat-prefetch both OFF,</span><br>
<span class="im">Tail the glusterfs log such like mnt-{VOLUME-NAME}.log, it still failed with &quot;file truncated&quot;,</span><br>
<br>
<span class="im">So that means if file's IO in huge amount, the issue will still be there even write-behind and stat-prefetch both OFF.</span><br>
<br>
<span class="im">Best Regards,</span><br>
<span class="im">George</span><br>
<br>
<span class="im">-----Original Message-----</span><br>
<span class="im">From: Raghavendra Gowdappa [mailto:<a href="mailto:rgowdapp@redhat.com">rgowdapp@redhat.com</a>]</span><o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">Sent: Wednesday, October 19, 2016 2:54 PM<br>
To: Lian, George (Nokia - CN/Hangzhou) &lt;<a href="mailto:george.lian@nokia.com">george.lian@nokia.com</a>&gt;<br>
Cc: <a href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a>; I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX_GMS &lt;<a href="mailto:I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com">I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com</a>&gt;; Zhang, Bingxuan (Nokia
 - CN/Hangzhou) &lt;<a href="mailto:bingxuan.zhang@nokia.com">bingxuan.zhang@nokia.com</a>&gt;; Zizka, Jan (Nokia - CZ/Prague) &lt;<a href="mailto:jan.zizka@nokia.com">jan.zizka@nokia.com</a>&gt;<br>
Subject: Re: [Gluster-devel] Issue about the size of fstat is less than the really size of the syslog file<br>
<br>
<br>
<br>
----- Original Message -----<br>
&gt; From: &quot;George Lian (Nokia - CN/Hangzhou)&quot; &lt;<a href="mailto:george.lian@nokia.com">george.lian@nokia.com</a>&gt;<br>
&gt; To: &quot;Raghavendra Gowdappa&quot; &lt;<a href="mailto:rgowdapp@redhat.com">rgowdapp@redhat.com</a>&gt;<br>
&gt; Cc: <a href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a>, &quot;I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX_GMS&quot;<br>
&gt; &lt;<a href="mailto:I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com">I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com</a>&gt;, &quot;Bingxuan Zhang (Nokia - CN/Hangzhou)&quot;<br>
&gt; &lt;<a href="mailto:bingxuan.zhang@nokia.com">bingxuan.zhang@nokia.com</a>&gt;, &quot;Jan Zizka (Nokia - CZ/Prague)&quot; &lt;<a href="mailto:jan.zizka@nokia.com">jan.zizka@nokia.com</a>&gt;<br>
&gt; Sent: Wednesday, October 19, 2016 12:05:01 PM<br>
&gt; Subject: RE: [Gluster-devel] Issue about the size of fstat is less than the really size of the syslog file<br>
&gt;<br>
&gt; Hi, Raghavendra,<br>
&gt;<br>
&gt; Thanks a lots for your quickly update!<br>
&gt; In my case, there are so many process(write) is writing to the syslog file,<br>
&gt; it do involve the writer is in the same host and writing in same mount point<br>
&gt; while the tail(reader) is reading it.<br>
&gt;<br>
&gt; The bug I just guess is:<br>
&gt; When a writer write the data with write-behind, it call the call-back<br>
&gt; function &quot; mdc_writev_cbk&quot; and called &quot;mdc_inode_iatt_set_validate&quot; to<br>
&gt; validate the &quot;iatt&quot; data, but with the code I mentioned last mail, it do<br>
&gt; nothing.<br>
<br>
mdc_inode_iatt_set_validate has following code<br>
<br>
&lt;snippet&gt;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!iatt || !iatt-&gt;ia_ctime) {<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; mdc-&gt;ia_time = 0;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; goto unlock;<br>
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br>
&lt;/snippet&gt;<br>
<br>
Which means a NULL iatt sets mdc-&gt;ia_time to 0. This results in subsequent lookup/stat calls to be NOT served from md-cache. Instead, the stat is served from backend bricks. So, I don't see an issue here.<br>
<br>
However, one case where a NULL iatt is different from a valid iatt (which differs from the value stored in md-cache) is that the latter results in a call to inode_invalidate. This invalidation propagates to kernel and all dentry and page cache corresponding
 to file is purged. So, I am suspecting whether the stale stat you saw was served from kernel cache (not from glusterfs). If this is the case, having mount options &quot;attribute-timeout=0&quot; and &quot;entry-timeout=0&quot; should've helped.<br>
<br>
I am still at loss to point out the RCA for this issue.<br>
<br>
<br>
&gt; And in same time, the reader(tail) read the &quot;iatt&quot; data, but in case of the<br>
&gt; cache-time is not timeout, it will return the &quot;iatt&quot; data without the last<br>
&gt; change.<br>
&gt;<br>
&gt; Do your think it is a possible bug?<br>
&gt;<br>
&gt; Thanks &amp; Best Regards,<br>
&gt; George<br>
&gt;<br>
&gt; -----Original Message-----<br>
&gt; From: Raghavendra Gowdappa [mailto:<a href="mailto:rgowdapp@redhat.com">rgowdapp@redhat.com</a>]<br>
&gt; Sent: Wednesday, October 19, 2016 2:06 PM<br>
&gt; To: Lian, George (Nokia - CN/Hangzhou) &lt;<a href="mailto:george.lian@nokia.com">george.lian@nokia.com</a>&gt;<br>
&gt; Cc: <a href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a>; I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX_GMS<br>
&gt; &lt;<a href="mailto:I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com">I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com</a>&gt;; Zhang, Bingxuan (Nokia -<br>
&gt; CN/Hangzhou) &lt;<a href="mailto:bingxuan.zhang@nokia.com">bingxuan.zhang@nokia.com</a>&gt;; Zizka, Jan (Nokia - CZ/Prague)<br>
&gt; &lt;<a href="mailto:jan.zizka@nokia.com">jan.zizka@nokia.com</a>&gt;<br>
&gt; Subject: Re: [Gluster-devel] Issue about the size of fstat is less than the<br>
&gt; really size of the syslog file<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; ----- Original Message -----<br>
&gt; &gt; From: &quot;George Lian (Nokia - CN/Hangzhou)&quot; &lt;<a href="mailto:george.lian@nokia.com">george.lian@nokia.com</a>&gt;<br>
&gt; &gt; To: &quot;Raghavendra Gowdappa&quot; &lt;<a href="mailto:rgowdapp@redhat.com">rgowdapp@redhat.com</a>&gt;<br>
&gt; &gt; Cc: <a href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a>, &quot;I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX_GMS&quot;<br>
&gt; &gt; &lt;<a href="mailto:I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com">I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com</a>&gt;, &quot;Bingxuan Zhang (Nokia<br>
&gt; &gt; - CN/Hangzhou)&quot;<br>
&gt; &gt; &lt;<a href="mailto:bingxuan.zhang@nokia.com">bingxuan.zhang@nokia.com</a>&gt;, &quot;Jan Zizka (Nokia - CZ/Prague)&quot;<br>
&gt; &gt; &lt;<a href="mailto:jan.zizka@nokia.com">jan.zizka@nokia.com</a>&gt;<br>
&gt; &gt; Sent: Wednesday, October 19, 2016 10:51:24 AM<br>
&gt; &gt; Subject: RE: [Gluster-devel] Issue about the size of fstat is less than the<br>
&gt; &gt; really size of the syslog file<br>
&gt; &gt;<br>
&gt; &gt; Hi, Raghavendra,<br>
&gt; &gt;<br>
&gt; &gt; When we disable md-cache(gluster volume set log<br>
&gt; &gt; performance.md-cache-timeout<br>
&gt; &gt; 0),&nbsp; the issue seems gone.<br>
&gt; &gt; (we can't disable with &quot; gluster volume set log performance.md-cache off&quot;<br>
&gt; &gt; why?)<br>
&gt;<br>
&gt; Please use<br>
&gt; #gluster volume set log performance.stat-prefetch off<br>
&gt;<br>
&gt; &gt;<br>
&gt; &gt; So I double confuse that the code I abstract in last mail maybe have some<br>
&gt; &gt; issue for this case.<br>
&gt; &gt; Could you please share your comments?<br>
&gt;<br>
&gt; Please find my comments below.<br>
&gt;<br>
&gt; &gt;<br>
&gt; &gt; Thanks &amp; Best Regards,<br>
&gt; &gt; George<br>
&gt; &gt;<br>
&gt; &gt; -----Original Message-----<br>
&gt; &gt; From: Lian, George (Nokia - CN/Hangzhou)<br>
&gt; &gt; Sent: Friday, October 14, 2016 1:44 PM<br>
&gt; &gt; To: 'Raghavendra Gowdappa' &lt;<a href="mailto:rgowdapp@redhat.com">rgowdapp@redhat.com</a>&gt;<br>
&gt; &gt; Cc: <a href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a>; I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX_GMS<br>
&gt; &gt; &lt;<a href="mailto:I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com">I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com</a>&gt;; Zhang, Bingxuan (Nokia<br>
&gt; &gt; -<br>
&gt; &gt; CN/Hangzhou) &lt;<a href="mailto:bingxuan.zhang@nokia.com">bingxuan.zhang@nokia.com</a>&gt;; Zizka, Jan (Nokia - CZ/Prague)<br>
&gt; &gt; &lt;<a href="mailto:jan.zizka@nokia.com">jan.zizka@nokia.com</a>&gt;<br>
&gt; &gt; Subject: RE: [Gluster-devel] Issue about the size of fstat is less than the<br>
&gt; &gt; really size of the syslog file<br>
&gt; &gt;<br>
&gt; &gt; Hi, Raghavendra,<br>
&gt; &gt;<br>
&gt; &gt; Our version of GlusterFS is 3.6.9, and I also check the newest code of main<br>
&gt; &gt; branch, the function of &quot; mdc_inode_iatt_set_validate&quot; is almost same, from<br>
&gt; &gt; the following code of this function,<br>
&gt; &gt; We could see a &quot;TODO&quot; comments inline, does it mean if we enhance<br>
&gt; &gt; write-behind feature, the &quot;iatt&quot; field in callback will be NULL, so that<br>
&gt; &gt; inode_invalidate will not be called? So the size of file will not update<br>
&gt; &gt; since &quot;write behind&quot; enabled ?<br>
&gt; &gt; Is it the root cause for &quot;tail&quot; application failed with &quot;file truncated&quot;<br>
&gt; &gt; issue ?<br>
&gt; &gt;<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;LOCK (&amp;mdc-&gt;lock);<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (!iatt || !iatt-&gt;ia_ctime) {<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mdc-&gt;ia_time = 0;<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;goto unlock;<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
&gt; &gt;<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;/*<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * Invalidate the inode if the mtime or ctime has changed<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * and the prebuf doesn't match the value we have cached.<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * TODO: writev returns with a NULL iatt due to<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; * performance/write-behind, causing invalidation on writes.<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; */<br>
&gt;<br>
&gt; The issue explained in this comment is hit only when writes are done. But, in<br>
&gt; your use-case only &quot;tail&quot; is the application running on the mount (If I am<br>
&gt; not wrong, the&nbsp; writer is running on a different mountpoint). So, I doubt<br>
&gt; you are hitting this issue. But, you are saying that the issue goes away<br>
&gt; when write-behind/md-cache is turned off pointing to some interaction<br>
&gt; between md-cache and write-behind causing the issue. I need more time to<br>
&gt; look into this issue. Can you file a bug on this?<br>
&gt;<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (IA_ISREG(inode-&gt;ia_type) &amp;&amp;<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;((iatt-&gt;ia_mtime != mdc-&gt;md_mtime) ||<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(iatt-&gt;ia_ctime != mdc-&gt;md_ctime)))<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (!prebuf || (prebuf-&gt;ia_ctime != mdc-&gt;md_ctime) ||<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(prebuf-&gt;ia_mtime != mdc-&gt;md_mtime))<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;inode_invalidate(inode);<br>
&gt; &gt;<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;mdc_from_iatt (mdc, iatt);<br>
&gt; &gt;<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;time (&amp;mdc-&gt;ia_time);<br>
&gt; &gt;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}<br>
&gt; &gt;<br>
&gt; &gt; Best Regards,<br>
&gt; &gt; George<br>
&gt; &gt; -----Original Message-----<br>
&gt; &gt; From: Raghavendra Gowdappa [mailto:<a href="mailto:rgowdapp@redhat.com">rgowdapp@redhat.com</a>]<br>
&gt; &gt; Sent: Thursday, October 13, 2016 8:58 PM<br>
&gt; &gt; To: Lian, George (Nokia - CN/Hangzhou) &lt;<a href="mailto:george.lian@nokia.com">george.lian@nokia.com</a>&gt;<br>
&gt; &gt; Cc: <a href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a>; I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX_GMS<br>
&gt; &gt; &lt;<a href="mailto:I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com">I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com</a>&gt;; Zhang, Bingxuan (Nokia<br>
&gt; &gt; -<br>
&gt; &gt; CN/Hangzhou) &lt;<a href="mailto:bingxuan.zhang@nokia.com">bingxuan.zhang@nokia.com</a>&gt;; Zizka, Jan (Nokia - CZ/Prague)<br>
&gt; &gt; &lt;<a href="mailto:jan.zizka@nokia.com">jan.zizka@nokia.com</a>&gt;<br>
&gt; &gt; Subject: Re: [Gluster-devel] Issue about the size of fstat is less than the<br>
&gt; &gt; really size of the syslog file<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt;<br>
&gt; &gt; ----- Original Message -----<br>
&gt; &gt; &gt; From: &quot;George Lian (Nokia - CN/Hangzhou)&quot; &lt;<a href="mailto:george.lian@nokia.com">george.lian@nokia.com</a>&gt;<br>
&gt; &gt; &gt; To: <a href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a><br>
&gt; &gt; &gt; Cc: &quot;I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX_GMS&quot;<br>
&gt; &gt; &gt; &lt;<a href="mailto:I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com">I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com</a>&gt;, &quot;Bingxuan Zhang<br>
&gt; &gt; &gt; (Nokia<br>
&gt; &gt; &gt; - CN/Hangzhou)&quot; &lt;<a href="mailto:bingxuan.zhang@nokia.com">bingxuan.zhang@nokia.com</a>&gt;, &quot;Jan Zizka (Nokia -<br>
&gt; &gt; &gt; CZ/Prague)&quot;<br>
&gt; &gt; &gt; &lt;<a href="mailto:jan.zizka@nokia.com">jan.zizka@nokia.com</a>&gt;<br>
&gt; &gt; &gt; Sent: Thursday, October 13, 2016 2:33:53 PM<br>
&gt; &gt; &gt; Subject: [Gluster-devel] Issue about the size of fstat is less than the<br>
&gt; &gt; &gt; really size of the syslog file<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; Hi, Dear Expert,<br>
&gt; &gt; &gt; We have use glusterfs as a network filesystem, and syslog store in there,<br>
&gt; &gt; &gt; some clients on different host may write the syslog file via </span>“<span lang="EN-US">glusterfs</span>”<span lang="EN-US"><br>
&gt; &gt; &gt; mount point.<br>
&gt; &gt; &gt; Now we encounter an issue when we </span>“<span lang="EN-US">tail</span>”<span lang="EN-US"> the syslog file, it will<br>
&gt; &gt; &gt; occasional<br>
&gt; &gt; &gt; failed with error </span>“<span lang="EN-US"> file truncated </span>”<span lang="EN-US"><br>
&gt; &gt; &gt; As we study and trace with the </span>“<span lang="EN-US">tail</span>”<span lang="EN-US"> source code, it failed with the<br>
&gt; &gt; &gt; following code:<br>
&gt; &gt; &gt; if ( S_ISREG (mode) &amp;&amp; stats.st_size &lt; f[i].size )<br>
&gt; &gt; &gt; {<br>
&gt; &gt; &gt; error (0, 0, _(&quot;%s: file truncated&quot;), quotef (name));<br>
&gt; &gt; &gt; /* Assume the file was truncated to 0,<br>
&gt; &gt; &gt; and therefore output all &quot;new&quot; data. */<br>
&gt; &gt; &gt; xlseek (fd, 0, SEEK_SET, name);<br>
&gt; &gt; &gt; f[i].size = 0;<br>
&gt; &gt; &gt; }<br>
&gt; &gt; &gt; When stats.st_size &lt; f[i].size, what mean the size report by fstat is<br>
&gt; &gt; &gt; less<br>
&gt; &gt; &gt; than </span>“<span lang="EN-US">tail</span>”<span lang="EN-US"> had read, it lead to
</span>“<span lang="EN-US">file truncated</span>”<span lang="EN-US">, we also use
</span>“<span lang="EN-US">strace</span>”<span lang="EN-US"><br>
&gt; &gt; &gt; tools to trace the tail application, the related tail strace log as the<br>
&gt; &gt; &gt; below:<br>
&gt; &gt; &gt; nanosleep({1, 0}, NULL) = 0<br>
&gt; &gt; &gt; fstat(3, {st_mode=S_IFREG|0644, st_size=192543105, ...}) = 0<br>
&gt; &gt; &gt; nanosleep({1, 0}, NULL) = 0<br>
&gt; &gt; &gt; fstat(3, {st_mode=S_IFREG|0644, st_size=192543105, ...}) = 0<br>
&gt; &gt; &gt; nanosleep({1, 0}, NULL) = 0<br>
&gt; &gt; &gt; fstat(3, {st_mode=S_IFREG|0644, st_size=192543105, ...}) = 0<br>
&gt; &gt; &gt; nanosleep({1, 0}, NULL) = 0<br>
&gt; &gt; &gt; fstat(3, {st_mode=S_IFREG|0644, st_size=192544549, ...}) = 0<br>
&gt; &gt; &gt; read(3, &quot; Data </span>…<span lang="EN-US"> -&quot;..., 8192) = 1444<br>
&gt; &gt; &gt; read(3, &quot; Data.. &quot;..., 8192) = 720<br>
&gt; &gt; &gt; read(3, &quot;&quot;, 8192) = 0<br>
&gt; &gt; &gt; fstat(3, {st_mode=S_IFREG|0644, st_size=192544789, ...}) = 0<br>
&gt; &gt; &gt; write(1, </span>“<span lang="EN-US">DATA</span>…<span lang="EN-US">..</span>”<span lang="EN-US"> ) = 2164<br>
&gt; &gt; &gt; write(2, &quot;tail: &quot;, 6tail: ) = 6<br>
&gt; &gt; &gt; write(2, &quot;/mnt/log/master/syslog: file tru&quot;..., 38/mnt/log/master/syslog:<br>
&gt; &gt; &gt; file truncated) = 38<br>
&gt; &gt; &gt; as the above strace log, tail has read 1444&#43;720=2164 bytes,<br>
&gt; &gt; &gt; but fstat tell </span>“<span lang="EN-US">tail</span>”<span lang="EN-US"> 192544789
</span>–<span lang="EN-US"> 192543105 = 1664 which less than 2164,<br>
&gt; &gt; &gt; so<br>
&gt; &gt; &gt; it lead to </span>“<span lang="EN-US">tail</span>”<span lang="EN-US"> application
</span>“<span lang="EN-US">file truncated</span>”<span lang="EN-US">.<br>
&gt; &gt; &gt; And if we turn off </span>“<span lang="EN-US">write-behind</span>”<span lang="EN-US"> feature, the issue will not be<br>
&gt; &gt; &gt; reproduced<br>
&gt; &gt; &gt; any more.<br>
&gt; &gt;<br>
&gt; &gt; That seems strange. There are no writes happening on the fd/inode through<br>
&gt; &gt; which tail is reading/stating from. So, it seems strange that write-behind<br>
&gt; &gt; is involved here. I suspect whether any of md-cache/read-ahead/io-cache is<br>
&gt; &gt; causing the issue. Can you,<br>
&gt; &gt;<br>
&gt; &gt; 1. Turn off md-cache, read-ahead, io-cache xlators<br>
&gt; &gt; 2. mount glusterfs with --attribute-timeout=0<br>
&gt; &gt; 3. set write-behind on<br>
&gt; &gt;<br>
&gt; &gt; and rerun the tests? If you don't hit the issue, you can experiment by<br>
&gt; &gt; turning on/off of md-cache, read-ahead and io-cache translators and see<br>
&gt; &gt; what<br>
&gt; &gt; are the minimal number of xlators that need to be turned off to not hit the<br>
&gt; &gt; issue (with write-behind on)?<br>
&gt; &gt;<br>
&gt; &gt; regards,<br>
&gt; &gt; Raghavendra<br>
&gt; &gt;<br>
&gt; &gt; &gt; So we think it may be related to cache consistence issue due to<br>
&gt; &gt; &gt; performance<br>
&gt; &gt; &gt; consider, but we still have concern that:<br>
&gt; &gt; &gt; The syslog file is used only with </span>“<span lang="EN-US">Append</span>”<span lang="EN-US"> mode, so the size of file<br>
&gt; &gt; &gt; shouldn</span>’<span lang="EN-US">t be reduced, when a client read the file, why
</span>“<span lang="EN-US">fstat</span>”<span lang="EN-US"> can</span>’<span lang="EN-US">t<br>
&gt; &gt; &gt; return<br>
&gt; &gt; &gt; the really size match to the cache?<br>
&gt; &gt; &gt; From current investigation, we doubt that the current implement of<br>
&gt; &gt; &gt; </span>“<span lang="EN-US">glusterfs</span>”<span lang="EN-US"> has a bug on
</span>“<span lang="EN-US">fstat</span>”<span lang="EN-US"> when cache is on.<br>
&gt; &gt; &gt; Your comments is our highly appreciated!<br>
&gt; &gt; &gt; Thanks &amp; Best Regards<br>
&gt; &gt; &gt; George<br>
&gt; &gt; &gt;<br>
&gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; Gluster-devel mailing list<br>
&gt; &gt; &gt; <a href="mailto:Gluster-devel@gluster.org">Gluster-devel@gluster.org</a><br>
&gt; &gt; &gt; <a href="http://www.gluster.org/mailman/listinfo/gluster-devel" target="_blank">
http://www.gluster.org/mailman/listinfo/gluster-devel</a><br>
&gt; &gt;<br>
&gt;<br>
_______________________________________________<br>
Gluster-devel mailing list<br>
<a href="mailto:Gluster-devel@gluster.org">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><o:p></o:p></span></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><span lang="EN-US"><br>
<br clear="all">
<br>
-- <o:p></o:p></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US">Pranith<o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</body>
</html>