<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:宋体;
        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.m-7458015297667022184im
        {mso-style-name:m_-7458015297667022184im;}
span.hoenzb
        {mso-style-name:hoenzb;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@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 will test it with your patches and update to you when I have result.<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 a lots
<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">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 [mailto:pkarampu@redhat.com]
<br>
<b>Sent:</b> Monday, October 31, 2016 11:23 AM<br>
<b>To:</b> Lian, George (Nokia - CN/Hangzhou) &lt;george.lian@nokia.com&gt;<br>
<b>Cc:</b> Raghavendra Gowdappa &lt;rgowdapp@redhat.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>
<p class="MsoNormal"><span lang="EN-US"><o:p>&nbsp;</o:p></span></p>
<div>
<div>
<div>
<div>
<div>
<div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US">Removing <a href="mailto:I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com">
I_EXT_MBB_WCDMA_SWD3_DA1_MATRIX@internal.nsn.com</a>, it is causing mail delivery problems for me.<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span lang="EN-US">George,<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Raghavendra and I made some progress on this issue. We were in parallel working on another issue which is similar where elastic search indices are getting corrupted because of wrong stat sizes in our opinion.
 So I have been running different translator stacks in identifying the problematic xlators which are leading to indices corruption.<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; We found the list to be 1) Write-behind, 2) Quick-read, 3) Readdir-ahead. Raghavendra and I just had a chat and we are suspecting that lack of lookup/readdirp implementation in write-behind
 could be the reason for this problem. Similar problems may exist in other two xlators too. But we are working on write-behind with priority.<o:p></o:p></span></p>
</div>
<p class="MsoNormal"><span lang="EN-US">Our theory is this:<o:p></o:p></span></p>
</div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US">If we do a 4KB write for example and it is cached in write-behind and we do a lookup on the file/do a readdirp on the directory with this file we send out wrong stat value to the kernel. There
 are different caches between kernel and gluster which may lead to fstat never coming till write-behind. So we need to make sure that we don't get into this situation.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span lang="EN-US">Action items:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US">&nbsp;At the moment Raghavendra is working on a patch to implement lookup/readdirp in write-behind. I am going to test the same for elastic search. Will it be possible for you to test your application
 against the same patch and confirm that the patch fixes the problem?<o:p></o:p></span></p>
</div>
</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 Fri, Oct 28, 2016 at 12:08 PM, Pranith Kumar Karampuri &lt;<a href="mailto:pkarampu@redhat.com" target="_blank">pkarampu@redhat.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-right:0cm">
<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>
<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-right:0cm">
<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="m-7458015297667022184im">Thanks &amp; Best Regards,</span><br>
<span class="m-7458015297667022184im">George</span><br>
<br>
<span class="m-7458015297667022184im">-----Original Message-----</span><br>
<span class="m-7458015297667022184im">From: Lian, George (Nokia - CN/Hangzhou)</span><br>
<span class="m-7458015297667022184im">Sent: Wednesday, October 19, 2016 4:40 PM</span><br>
<span class="m-7458015297667022184im">To: 'Raghavendra Gowdappa' &lt;<a href="mailto:rgowdapp@redhat.com" target="_blank">rgowdapp@redhat.com</a>&gt;</span><br>
<span class="m-7458015297667022184im">Cc: <a href="mailto:Gluster-devel@gluster.org" target="_blank">
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" target="_blank">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" target="_blank">bingxuan.zhang@nokia.com</a>&gt;;
 Zizka, Jan (Nokia - CZ/Prague) &lt;<a href="mailto:jan.zizka@nokia.com" target="_blank">jan.zizka@nokia.com</a>&gt;</span><br>
<span class="m-7458015297667022184im">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="m-7458015297667022184im">Hi, Raghavendra</span><br>
<br>
<span class="m-7458015297667022184im">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="m-7458015297667022184im">Tail the glusterfs log such like mnt-{VOLUME-NAME}.log, it still failed with &quot;file truncated&quot;,</span><br>
<br>
<span class="m-7458015297667022184im">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="m-7458015297667022184im">Best Regards,</span><br>
<span class="m-7458015297667022184im">George</span><br>
<br>
<span class="m-7458015297667022184im">-----Original Message-----</span><br>
<span class="m-7458015297667022184im">From: Raghavendra Gowdappa [mailto:<a href="mailto:rgowdapp@redhat.com" target="_blank">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" target="_blank">george.lian@nokia.com</a>&gt;<br>
Cc: <a href="mailto:Gluster-devel@gluster.org" target="_blank">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" target="_blank">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" target="_blank">bingxuan.zhang@nokia.com</a>&gt;; Zizka, Jan (Nokia - CZ/Prague) &lt;<a href="mailto:jan.zizka@nokia.com" target="_blank">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" target="_blank">george.lian@nokia.com</a>&gt;<br>
&gt; To: &quot;Raghavendra Gowdappa&quot; &lt;<a href="mailto:rgowdapp@redhat.com" target="_blank">rgowdapp@redhat.com</a>&gt;<br>
&gt; Cc: <a href="mailto:Gluster-devel@gluster.org" target="_blank">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" target="_blank">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" target="_blank">bingxuan.zhang@nokia.com</a>&gt;, &quot;Jan Zizka (Nokia - CZ/Prague)&quot; &lt;<a href="mailto:jan.zizka@nokia.com" target="_blank">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" target="_blank">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" target="_blank">george.lian@nokia.com</a>&gt;<br>
&gt; Cc: <a href="mailto:Gluster-devel@gluster.org" target="_blank">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" target="_blank">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" target="_blank">bingxuan.zhang@nokia.com</a>&gt;; Zizka, Jan (Nokia - CZ/Prague)<br>
&gt; &lt;<a href="mailto:jan.zizka@nokia.com" target="_blank">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" target="_blank">george.lian@nokia.com</a>&gt;<br>
&gt; &gt; To: &quot;Raghavendra Gowdappa&quot; &lt;<a href="mailto:rgowdapp@redhat.com" target="_blank">rgowdapp@redhat.com</a>&gt;<br>
&gt; &gt; Cc: <a href="mailto:Gluster-devel@gluster.org" target="_blank">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" target="_blank">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" target="_blank">bingxuan.zhang@nokia.com</a>&gt;, &quot;Jan Zizka (Nokia - CZ/Prague)&quot;<br>
&gt; &gt; &lt;<a href="mailto:jan.zizka@nokia.com" target="_blank">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" target="_blank">rgowdapp@redhat.com</a>&gt;<br>
&gt; &gt; Cc: <a href="mailto:Gluster-devel@gluster.org" target="_blank">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" target="_blank">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" target="_blank">bingxuan.zhang@nokia.com</a>&gt;; Zizka, Jan (Nokia - CZ/Prague)<br>
&gt; &gt; &lt;<a href="mailto:jan.zizka@nokia.com" target="_blank">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" target="_blank">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" target="_blank">george.lian@nokia.com</a>&gt;<br>
&gt; &gt; Cc: <a href="mailto:Gluster-devel@gluster.org" target="_blank">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" target="_blank">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" target="_blank">bingxuan.zhang@nokia.com</a>&gt;; Zizka, Jan (Nokia - CZ/Prague)<br>
&gt; &gt; &lt;<a href="mailto:jan.zizka@nokia.com" target="_blank">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" target="_blank">george.lian@nokia.com</a>&gt;<br>
&gt; &gt; &gt; To: <a href="mailto:Gluster-devel@gluster.org" target="_blank">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" target="_blank">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" target="_blank">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" target="_blank">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 “glusterfs”<br>
&gt; &gt; &gt; mount point.<br>
&gt; &gt; &gt; Now we encounter an issue when we “tail” the syslog file, it will<br>
&gt; &gt; &gt; occasional<br>
&gt; &gt; &gt; failed with error “ file truncated ”<br>
&gt; &gt; &gt; As we study and trace with the “tail” 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 “tail” had read, it lead to “file truncated”, we also use “strace”<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 … -&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, “DATA…..” ) = 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 “tail” 192544789 – 192543105 = 1664 which less than 2164,<br>
&gt; &gt; &gt; so<br>
&gt; &gt; &gt; it lead to “tail” application “file truncated”.<br>
&gt; &gt; &gt; And if we turn off “write-behind” 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 “Append” mode, so the size of file<br>
&gt; &gt; &gt; shouldn’t be reduced, when a client read the file, why “fstat” can’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; “glusterfs” has a bug on “fstat” 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" target="_blank">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" 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><o:p></o:p></span></p>
</div>
</div>
</blockquote>
</div>
<p class="MsoNormal"><span lang="EN-US"><br>
<br clear="all">
<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><span class="hoenzb"><span lang="EN-US" style="color:#888888">--
<o:p></o:p></span></span></p>
<div>
<div>
<p class="MsoNormal"><span lang="EN-US" style="color:#888888">Pranith</span><span lang="EN-US"><o:p></o:p></span></p>
</div>
</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>