<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style>body { line-height: 1.5; }blockquote { margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em; }p { margin-top: 0px; margin-bottom: 0px; }div.foxdiv20160420092216278887 { }body { font-size: 16pt; font-family: 微软雅黑; color: rgb(0, 0, 0); line-height: 1.5; }</style>
</head>
<body>
<div><span></span></div>
<blockquote style="margin-top: 0px; margin-bottom: 0px; margin-left: 0.5em;">
<div class="FoxDiv20160420092216278887">
<p style="font-size: 16px;"><span style="line-height: 19px; background-color: rgb(255, 255, 255);">&nbsp;</span></p>
<p><font face="Consolas" size="3"><span style="line-height: 19px;">Hi everyone</span></font></p>
<p><font face="Consolas" size="3"><span style="line-height: 19px;"><br>
</span></font></p>
<p style="font-size: 16px;"><font face="Consolas" size="2" style="font-size: 16px;"><span style="background-color: rgb(255, 255, 255);"><span style="line-height: 19px;">In ocfs2, when one storage volume can't access, all&nbsp;</span><span style="line-height: 19px;">nodes
 which have mounted the&nbsp;</span><span style="line-height: 19px;">volume</span><span style="line-height: 19px;">&nbsp;will fence self</span></span></font></p>
<p style="font-size: 16px;"><font face="Consolas" size="2" style="font-size: 16px;"><span style="background-color: rgb(255, 255, 255);"><span style="line-height: 19px;">due to write timeout or io error.&nbsp;</span></span></font><span style="font-family: Consolas; line-height: 16.0160007476807px; widows: 1;">So
 I make a useful attempt to add autoumount option.&nbsp;</span></p>
<p style="font-size: 16px;"><span style="font-family: Consolas; line-height: 16.0160007476807px; widows: 1;">in the case,&nbsp;</span><span style="font-family: Consolas; line-height: normal; widows: 1;">I know that for some reason umount may be hung.</span><font style="font-family: Consolas; line-height: 1.5; widows: 1;"><span style="line-height: 30px;">Based
 on the analysis process of ocfs2 umount,</span></font></p>
<p style="font-size: 16px;"><font style="font-family: Consolas; line-height: 1.5; widows: 1;"><span style="line-height: 30px;">it's&nbsp;</span></font><span style="font-family: Consolas; widows: 1; line-height: 30px;">possible</span><span style="font-family: Consolas; widows: 1; line-height: 30px;">&nbsp;</span><span style="font-family: Consolas; line-height: 1.5; widows: 1;">to
 complete all locks and wake up block events before umounting the volume.</span></p>
<p><span style="font-size: 16px; widows: 1; line-height: 1.5; background-color: rgb(255, 255, 255);"><font face="Consolas" size="2" style="font-size: 16px;">the way is to work well by forever&nbsp;</font></span><font face="Consolas"><span style="font-size: 16px; line-height: 18px; widows: 1;">experimenting
 and devising&nbsp;</span><span style="line-height: 18px; widows: 1;"><font size="3">tests.the patch may be release in the recent times.</font></span></font></p>
<p><font face="Consolas"><span style="line-height: 18px; widows: 1;"><font size="3">Is the patch risky and reasonable?
</font></span></font><font face="Consolas" size="3"><span style="line-height: normal;">what do you think ?</span><span style="line-height: normal;">&nbsp;Thanks</span></font></p>
<p style="font-size: 16px;"><font size="2" face="Consolas" style="background-color: window; line-height: normal; font-size: 16px;">Best regards</font></p>
<p style="font-size: 16px;"><br>
</p>
<p><br>
</p>
<p><font size="2">------------------------------<br>
<br>
Message: 3<br>
Date: Thu, 24 Mar 2016 10:50:31 &#43;0800<br>
From: Junxiao Bi &lt;junxiao.bi@oracle.com&gt;<br>
Subject: Re: [Ocfs2-devel] [patch 19/25] ocfs2: o2hb: add negotiate<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; timer<br>
To: akpm@linux-foundation.org, mfasheh@suse.de, jlbec@evilplan.org,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; joseph.qi@huawei.com, ocfs2-devel@oss.oracle.com, ghe@suse.com,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; rwxybh@126.com, ryan.ding@oracle.com<br>
Message-ID: &lt;56F355F7.2040004@oracle.com&gt;<br>
Content-Type: text/plain; charset=windows-1252<br>
<br>
This is v1 version, I sent out V2 patch set before to fix all code style<br>
issue.<br>
<br>
On 03/24/2016 04:12 AM, akpm@linux-foundation.org wrote:<br>
&gt; From: Junxiao Bi &lt;junxiao.bi@oracle.com&gt;<br>
&gt; Subject: ocfs2: o2hb: add negotiate timer<br>
&gt;<br>
&gt; This series of patches is to fix the issue that when storage down, all<br>
&gt; nodes will fence self due to write timeout.<br>
&gt;<br>
&gt; With this patch set, all nodes will keep going until storage back online,<br>
&gt; except if the following issue happens, then all nodes will do as before to<br>
&gt; fence self.<br>
&gt;<br>
&gt; 1. io error got<br>
&gt; 2. network between nodes down<br>
&gt; 3. nodes panic<br>
&gt;<br>
&gt;<br>
&gt; This patch (of 6):<br>
&gt;<br>
&gt; When storage down, all nodes will fence self due to write timeout.&nbsp; The<br>
&gt; negotiate timer is designed to avoid this, with it node will wait until<br>
&gt; storage up again.<br>
&gt;<br>
&gt; Negotiate timer working in the following way:<br>
&gt;<br>
&gt; 1. The timer expires before write timeout timer, its timeout is half<br>
&gt;&nbsp;&nbsp;&nbsp; of write timeout now.&nbsp; It is re-queued along with write timeout timer.<br>
&gt;&nbsp;&nbsp;&nbsp; If expires, it will send NEGO_TIMEOUT message to master node(node with<br>
&gt;&nbsp;&nbsp;&nbsp; lowest node number).&nbsp; This message does nothing but marks a bit in a<br>
&gt;&nbsp;&nbsp;&nbsp; bitmap recording which nodes are negotiating timeout on master node.<br>
&gt;<br>
&gt; 2. If storage down, nodes will send this message to master node, then<br>
&gt;&nbsp;&nbsp;&nbsp; when master node finds its bitmap including all online nodes, it sends<br>
&gt;&nbsp;&nbsp;&nbsp; NEGO_APPROVL message to all nodes one by one, this message will<br>
&gt;&nbsp;&nbsp;&nbsp; re-queue write timeout timer and negotiate timer.&nbsp; For any node doesn't<br>
&gt;&nbsp;&nbsp;&nbsp; receive this message or meets some issue when handling this message, it<br>
&gt;&nbsp;&nbsp;&nbsp; will be fenced.&nbsp; If storage up at any time, o2hb_thread will run and<br>
&gt;&nbsp;&nbsp;&nbsp; re-queue all the timer, nothing will be affected by these two steps.<br>
&gt;<br>
&gt; Signed-off-by: Junxiao Bi &lt;junxiao.bi@oracle.com&gt;<br>
&gt; Reviewed-by: Ryan Ding &lt;ryan.ding@oracle.com&gt;<br>
&gt; Cc: Gang He &lt;ghe@suse.com&gt;<br>
&gt; Cc: rwxybh &lt;rwxybh@126.com&gt;<br>
&gt; Cc: Mark Fasheh &lt;mfasheh@suse.de&gt;<br>
&gt; Cc: Joel Becker &lt;jlbec@evilplan.org&gt;<br>
&gt; Cc: Joseph Qi &lt;joseph.qi@huawei.com&gt;<br>
&gt; Signed-off-by: Andrew Morton &lt;akpm@linux-foundation.org&gt;<br>
&gt; ---<br>
&gt;<br>
&gt;&nbsp; fs/ocfs2/cluster/heartbeat.c |&nbsp;&nbsp; 52 &#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;&#43;---<br>
&gt;&nbsp; 1 file changed, 48 insertions(&#43;), 4 deletions(-)<br>
&gt;<br>
&gt; diff -puN fs/ocfs2/cluster/heartbeat.c~ocfs2-o2hb-add-negotiate-timer fs/ocfs2/cluster/heartbeat.c<br>
&gt; --- a/fs/ocfs2/cluster/heartbeat.c~ocfs2-o2hb-add-negotiate-timer<br>
&gt; &#43;&#43;&#43; a/fs/ocfs2/cluster/heartbeat.c<br>
&gt; @@ -272,6 &#43;272,10 @@ struct o2hb_region {<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; struct delayed_work&nbsp;&nbsp;&nbsp;&nbsp; hr_write_timeout_work;<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; unsigned long&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hr_last_timeout_start;<br>
&gt;&nbsp;<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; /* negotiate timer, used to negotiate extending hb timeout. */<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; struct delayed_work&nbsp;&nbsp;&nbsp;&nbsp; hr_nego_timeout_work;<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; unsigned long&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hr_nego_node_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)];<br>
&gt; &#43;<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; /* Used during o2hb_check_slot to hold a copy of the block<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * being checked because we temporarily have to zero out the<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * crc field. */<br>
&gt; @@ -319,7 &#43;323,7 @@ static void o2hb_write_timeout(struct wo<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; o2quo_disk_timeout();<br>
&gt;&nbsp; }<br>
&gt;&nbsp;<br>
&gt; -static void o2hb_arm_write_timeout(struct o2hb_region *reg)<br>
&gt; &#43;static void o2hb_arm_timeout(struct o2hb_region *reg)<br>
&gt;&nbsp; {<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; /* Arm writeout only after thread reaches steady state */<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; if (atomic_read(&amp;reg-&gt;hr_steady_iterations) != 0)<br>
&gt; @@ -337,11 &#43;341,50 @@ static void o2hb_arm_write_timeout(struc<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; reg-&gt;hr_last_timeout_start = jiffies;<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; schedule_delayed_work(&amp;reg-&gt;hr_write_timeout_work,<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; msecs_to_jiffies(O2HB_MAX_WRITE_TIMEOUT_MS));<br>
&gt; &#43;<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; cancel_delayed_work(&amp;reg-&gt;hr_nego_timeout_work);<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; /* negotiate timeout must be less than write timeout. */<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; schedule_delayed_work(&amp;reg-&gt;hr_nego_timeout_work,<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; msecs_to_jiffies(O2HB_MAX_WRITE_TIMEOUT_MS)/2);<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; memset(reg-&gt;hr_nego_node_bitmap, 0, sizeof(reg-&gt;hr_nego_node_bitmap));<br>
&gt;&nbsp; }<br>
&gt;&nbsp;<br>
&gt; -static void o2hb_disarm_write_timeout(struct o2hb_region *reg)<br>
&gt; &#43;static void o2hb_disarm_timeout(struct o2hb_region *reg)<br>
&gt;&nbsp; {<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; cancel_delayed_work_sync(&amp;reg-&gt;hr_write_timeout_work);<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; cancel_delayed_work_sync(&amp;reg-&gt;hr_nego_timeout_work);<br>
&gt; &#43;}<br>
&gt; &#43;<br>
&gt; &#43;static void o2hb_nego_timeout(struct work_struct *work)<br>
&gt; &#43;{<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; struct o2hb_region *reg =<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; container_of(work, struct o2hb_region,<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; hr_nego_timeout_work.work);<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; unsigned long live_node_bitmap[BITS_TO_LONGS(O2NM_MAX_NODES)];<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; int master_node;<br>
&gt; &#43;<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; o2hb_fill_node_map(live_node_bitmap, sizeof(live_node_bitmap));<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; /* lowest node as master node to make negotiate decision. */<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; master_node = find_next_bit(live_node_bitmap, O2NM_MAX_NODES, 0);<br>
&gt; &#43;<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; if (master_node == o2nm_this_node()) {<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; set_bit(master_node, reg-&gt;hr_nego_node_bitmap);<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (memcmp(reg-&gt;hr_nego_node_bitmap, live_node_bitmap,<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sizeof(reg-&gt;hr_nego_node_bitmap))) {<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* check negotiate bitmap every second to do timeout<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * approve decision.<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; */<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; schedule_delayed_work(&amp;reg-&gt;hr_nego_timeout_work,<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; msecs_to_jiffies(1000));<br>
&gt; &#43;<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&gt; &#43;<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* approve negotiate timeout request. */<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; } else {<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* negotiate timeout with master node. */<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&gt; &#43;<br>
&gt;&nbsp; }<br>
&gt;&nbsp;<br>
&gt;&nbsp; static inline void o2hb_bio_wait_init(struct o2hb_bio_wait_ctxt *wc)<br>
&gt; @@ -1032,7 &#43;1075,7 @@ static int o2hb_do_disk_heartbeat(struct<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; /* Skip disarming the timeout if own slot has stale/bad data */<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; if (own_slot_ok) {<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o2hb_set_quorum_device(reg);<br>
&gt; -&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o2hb_arm_write_timeout(reg);<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; o2hb_arm_timeout(reg);<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }<br>
&gt;&nbsp;<br>
&gt;&nbsp; bail:<br>
&gt; @@ -1114,7 &#43;1157,7 @@ static int o2hb_thread(void *data)<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }<br>
&gt;&nbsp;<br>
&gt; -&nbsp;&nbsp;&nbsp;&nbsp; o2hb_disarm_write_timeout(reg);<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; o2hb_disarm_timeout(reg);<br>
&gt;&nbsp;<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; /* unclean stop is only used in very bad situation */<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; for(i = 0; !reg-&gt;hr_unclean_stop &amp;&amp; i &lt; reg-&gt;hr_blocks; i&#43;&#43;)<br>
&gt; @@ -1763,6 &#43;1806,7 @@ static ssize_t o2hb_region_dev_store(str<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; }<br>
&gt;&nbsp;<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; INIT_DELAYED_WORK(&amp;reg-&gt;hr_write_timeout_work, o2hb_write_timeout);<br>
&gt; &#43;&nbsp;&nbsp;&nbsp;&nbsp; INIT_DELAYED_WORK(&amp;reg-&gt;hr_nego_timeout_work, o2hb_nego_timeout);<br>
&gt;&nbsp;<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; /*<br>
&gt;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; * A node is considered live after it has beat LIVE_THRESHOLD<br>
&gt; _<br>
&gt;<br>
<br>
</font></p>
</div>
</blockquote>
<span style="font-size:7.5pt;font-family:华文细黑;color:gray"><span lang="EN-US">-------------------------------------------------------------------------------------------------------------------------------------<br>
</span>本邮件及其附件含有杭州华三通信技术有限公司的保密信息,仅限于发送给上面地址中列出<span lang="EN-US"><br>
</span>的个人或群组。禁止任何其他人以任何形式使用(包括但不限于全部或部分地泄露、复制、<span lang="EN-US"><br>
</span>或散发)本邮件中的信息。如果您错收了本邮件,请您立即电话或邮件通知发件人并删除本<span lang="EN-US"><br>
</span>邮件!<span lang="EN-US"><br>
</span></span><span lang="EN-US" style="font-size:7.5pt;font-family:&quot;Arial&quot;,&quot;sans-serif&quot;;color:gray">This e-mail and its attachments contain confidential information from H3C, which is
<br>
intended only for the person or entity whose address is listed above. Any use of the
<br>
information contained herein in any way (including, but not limited to, total or partial
<br>
disclosure, reproduction, or dissemination) by persons other than the intended <br>
recipient(s) is prohibited. If you receive this e-mail in error, please notify the sender
<br>
by phone or email immediately and delete it!</span>
</body>
</html>