<div dir="ltr"><pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">Hi,</pre>
<pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px"><br></pre><pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">
I use DRBD ver 8.3.15 with configuratios</pre><pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">
  &quot;net &ndash; on-congestion = pull-ahead&quot;.</pre><pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">
  &quot;protocol C&quot;</pre><pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">
The connect state &ldquo;Ahead&rdquo; and never resync again.</pre><pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">
&quot;Ahead Stuck&quot; Problem.
</pre><pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px"><br></pre>
<pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">Fortunately, I can reproduce this problem with two</pre>
<pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">I/O generaotors &quot;fio&quot; on Virtual Machines of</pre>
<pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">VMFS5(ESXi Server v5.0u1) in 3 minutes.</pre>
<pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px"><br></pre><pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">
So, I analisys the Ahead-&gt;SourceSync mechanizm by runnning code.</pre><pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">
<br></pre><pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">At function got_BarrierACK (drbd_receiver.c) will</pre>
<pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">try to resync again.</pre>
<pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">But when mdev-&gt;ap_in_flight is negative value,&nbsp;can not resync again.</pre>
<pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px"><br></pre><pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">
I modified the source &quot;drbd_receiver.c&quot; and the problem is away at</pre><pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">
the I/O pattern.</pre><pre style="word-wrap:break-word;margin-top:0px;margin-bottom:0px"><font color="#000000" face="courier, courier new, monospace"><span style="font-size:14px;line-height:19.600000381469727px;white-space:pre-wrap"><br>
</span></font></pre><pre style="word-wrap:break-word;margin-top:0px;margin-bottom:0px"><font color="#000000" face="courier, courier new, monospace"><span style="font-size:14px;line-height:19.600000381469727px;white-space:pre-wrap">The value &quot;mdev-&gt;ap_in_flight&quot; is used for only for</span></font></pre>
<pre style="word-wrap:break-word;margin-top:0px;margin-bottom:0px"><font color="#000000" face="courier, courier new, monospace"><span style="font-size:14px;line-height:19.600000381469727px;white-space:pre-wrap">&quot;congestion fill&quot;, I think. Is this right?</span></font></pre>
<pre style="word-wrap:break-word;margin-top:0px;margin-bottom:0px"><br></pre><pre style="word-wrap:break-word;margin-top:0px;margin-bottom:0px"><font color="#000000" face="courier, courier new, monospace"><span style="font-size:14px;line-height:19.600000381469727px;white-space:pre-wrap">Please check difference below!!</span></font></pre>
<pre style="word-wrap:break-word;margin-top:0px;margin-bottom:0px"><span style="font-size:14px;line-height:19.600000381469727px;white-space:pre-wrap;color:rgb(0,0,0);font-family:courier,&#39;courier new&#39;,monospace"><br>
</span></pre><pre style="word-wrap:break-word;margin-top:0px;margin-bottom:0px"><span style="font-size:14px;line-height:19.600000381469727px;white-space:pre-wrap;color:rgb(0,0,0);font-family:courier,&#39;courier new&#39;,monospace">==[[Difference]]=================================</span><br>
</pre><pre style="word-wrap:break-word;margin-top:0px;margin-bottom:0px"><font color="#000000" face="courier, courier new, monospace"><span style="font-size:14px;line-height:19.600000381469727px;white-space:pre-wrap"># diff -c drbd_receiver.c.old drbd_receiver.c
*** drbd_receiver.c.old
--- drbd_receiver.c
***************
*** 4815,4831 ****
        return true;
  }

  STATIC int got_BarrierAck(struct drbd_conf *mdev, struct p_header80 *h)
  {
        struct p_barrier_ack *p = (struct p_barrier_ack *)h;

        tl_release(mdev, p-&gt;barrier, be32_to_cpu(p-&gt;set_size));

        if (mdev-&gt;state.conn == C_AHEAD &amp;&amp;
!           atomic_read(&amp;mdev-&gt;ap_in_flight) == 0 &amp;&amp;
            !drbd_test_and_set_flag(mdev, AHEAD_TO_SYNC_SOURCE)) {
                mdev-&gt;start_resync_timer.expires = jiffies + HZ;
                add_timer(&amp;mdev-&gt;start_resync_timer);
        }

        return true;
</span></font><span style="font-size:14px;line-height:19.600000381469727px;white-space:pre-wrap;color:rgb(0,0,0);font-family:courier,&#39;courier new&#39;,monospace">--- 4815,4846 ----</span></pre><pre style="word-wrap:break-word;margin-top:0px;margin-bottom:0px">
<font color="#000000" face="courier, courier new, monospace"><span style="font-size:14px;line-height:19.600000381469727px;white-space:pre-wrap">        return true;
  }

+ /* Fix Ahead Stuck Problem */
  STATIC int got_BarrierAck(struct drbd_conf *mdev, struct p_header80 *h)
  {
        struct p_barrier_ack *p = (struct p_barrier_ack *)h;

        tl_release(mdev, p-&gt;barrier, be32_to_cpu(p-&gt;set_size));

+ /*[Debug] Output Detail */
+         dev_info( DEV, &quot;got_BarrierACK(state.conn=%d,ap_in_flight=%d)\n&quot;,
+                   mdev-&gt;state.conn, atomic_read(&amp;mdev-&gt;ap_in_flight) );
+
        if (mdev-&gt;state.conn == C_AHEAD &amp;&amp;
! /* ap_in_flight is sometime less than zero */
! /*        atomic_read(&amp;mdev-&gt;ap_in_flight) == 0 &amp;&amp; */
!           atomic_read(&amp;mdev-&gt;ap_in_flight) &lt;= 0 &amp;&amp;
            !drbd_test_and_set_flag(mdev, AHEAD_TO_SYNC_SOURCE)) {
+
+ /* Reset ap_in_flight into zero */
+               atomic_set(&amp;mdev-&gt;ap_in_flight, 0);
+
                mdev-&gt;start_resync_timer.expires = jiffies + HZ;
                add_timer(&amp;mdev-&gt;start_resync_timer);
+
+ /*[Debug] resync timer start*/
+               dev_info(DEV,&quot;start resync timer!!\n&quot; );
+
        }

        return true;</span></font><span style="color:rgb(0,0,0);font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;line-height:19.600000381469727px;white-space:pre-wrap">
</span></pre><div><br></div><pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">
<br></pre><pre style="font-family:courier,&#39;courier new&#39;,monospace;font-size:14px;white-space:pre-wrap;word-wrap:break-word;margin-top:0px;margin-bottom:0px;color:rgb(0,0,0);line-height:19.600000381469727px">Regards</pre>
</div>