<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Feb 13, 2016 at 12:38 AM, Richard Wareing <span dir="ltr">&lt;<a href="mailto:rwareing@fb.com" target="_blank">rwareing@fb.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>
<div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt">Hey,
<div><br>
</div>
<div>Sorry for the late reply but I missed this e-mail.  With respect to identifying locking domains,<span style="font-size:13.3333px"> we use the identical logic that GlusterFS itself uses to identify the domains; which is just a simple string comparison
 if I&#39;m not mistaken.   System processes (SHD/Rebalance) locking domains are treated identical to any other, this is specifically critical to things like DHT healing as this locking domain is used both in userland and by SHDs (you cannot disable DHT healing).
</span></div></div></div></blockquote><div><br></div><div style="">We cannot disable DHT healing altogether. But we _can_ identify whether healing is done by a mount process (on behalf of application) or a rebalance process. All internal processes (rebalance, shd, quotad etc) have a negative value in frame-&gt;root-&gt;pid (as opposed to a positive value for a fop request from a mount process). I agree with you that just by looking at domain, we cannot figure out whether lock request is from internal process or a mount process. But, with the help of frame-&gt;root-&gt;pid, we can. By choosing to flush locks from rebalance process (instead of locks from mount process), I thought we can reduce the scenarios where application sees errors. Of course we&#39;ll see more of rebalance failures, but that is a trade-off we perhaps have to live with. Just a thought :).</div><div style=""><br></div><div style=""> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div style="direction:ltr;font-family:Tahoma;color:#000000;font-size:10pt"><div><span style="font-size:13.3333px">  To illustrate this, consider the case where a SHD holds a lock to do a DHT heal but can&#39;t because of GFID split-brain....a user comes along a hammers that directory attempting to get a lock....you can pretty much kiss your cluster good-bye after that :).</span></div>
<div><span style="font-size:13.3333px"><br>
</span></div>
<div>With this in mind, we explicitly choose not to respect system process (SHD/rebalance) locks any more than a user lock request as they can be just as likely (if not more so) to cause a system to fall over vs. a user (see example above).  Although this might
 seem unwise at first, I&#39;d put forth that having clusters fall over catastrophically pushes far worse decisions on operators such as re-kicking random bricks or entire clusters in desperate attempts at freeing locks (the CLI is often unable to free the locks
 in our experience) or stopping run away memory consumption due to frames piling up on the bricks.  To date, we haven&#39;t even observed a single instance of data corruption (and we&#39;ve been looking for it!) due to this feature.<br>
<br>
We&#39;ve even used it on clusters where they were on the verge of falling over and we enable revocation and the entire system stabilizes almost instantly (it&#39;s really like magic when you see it :) ).<br>
<br>
</div>
<div>Hope this helps!</div>
<div><br>
</div>
<div>Richard</div>
<div><br>
</div>
<div><br>
<div style="font-family:Times New Roman;color:#000000;font-size:16px">
<hr>
<div style="direction:ltr"><font face="Tahoma" size="2" color="#000000"><b>From:</b> <a href="mailto:raghavendra.hg@gmail.com" target="_blank">raghavendra.hg@gmail.com</a> [<a href="mailto:raghavendra.hg@gmail.com" target="_blank">raghavendra.hg@gmail.com</a>] on behalf of Raghavendra G [<a href="mailto:raghavendra@gluster.com" target="_blank">raghavendra@gluster.com</a>]<br>
<b>Sent:</b> Tuesday, January 26, 2016 9:49 PM<br>
<b>To:</b> Raghavendra Gowdappa<span class=""><br>
<b>Cc:</b> Richard Wareing; Gluster Devel<br>
</span><div><div class="h5"><b>Subject:</b> Re: [Gluster-devel] Feature: Automagic lock-revocation for features/locks xlator (v3.7.x)<br>
</div></div></font><br>
</div><div><div class="h5">
<div></div>
<div>
<div dir="ltr"><br>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Jan 25, 2016 at 10:39 AM, Raghavendra Gowdappa <span dir="ltr">
&lt;<a href="mailto:rgowdapp@redhat.com" target="_blank">rgowdapp@redhat.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span><br>
<br>
----- Original Message -----<br>
&gt; From: &quot;Richard Wareing&quot; &lt;<a href="mailto:rwareing@fb.com" target="_blank">rwareing@fb.com</a>&gt;<br>
&gt; To: &quot;Pranith Kumar Karampuri&quot; &lt;<a href="mailto:pkarampu@redhat.com" target="_blank">pkarampu@redhat.com</a>&gt;<br>
&gt; Cc: <a href="mailto:gluster-devel@gluster.org" target="_blank">gluster-devel@gluster.org</a><br>
&gt; Sent: Monday, January 25, 2016 8:17:11 AM<br>
&gt; Subject: Re: [Gluster-devel] Feature: Automagic lock-revocation for features/locks xlator (v3.7.x)<br>
&gt;<br>
&gt; Yup per domain would be useful, the patch itself currently honors domains as<br>
&gt; well. So locks in a different domains will not be touched during revocation.<br>
&gt;<br>
&gt; In our cases we actually prefer to pull the plug on SHD/DHT domains to ensure<br>
&gt; clients do not hang, this is important for DHT self heals which cannot be<br>
&gt; disabled via any option, we&#39;ve found in most cases once we reap the lock<br>
&gt; another properly behaving client comes along and completes the DHT heal<br>
&gt; properly.<br>
<br>
</span>Flushing waiting locks of DHT can affect application continuity too. Though locks requested by rebalance process can be flushed to certain extent without applications noticing any failures, there is no guarantee that locks requested in DHT_LAYOUT_HEAL_DOMAIN
 and DHT_FILE_MIGRATE_DOMAIN, are issued by only rebalance process.</blockquote>
<div><br>
</div>
<div>I missed this point in my previous mail. Now I remember that we can use frame-&gt;root-&gt;pid (being negative) to identify internal processes. Was this the approach you followed to identify locks from rebalance process?</div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
These two domains are used for locks to synchronize among and between rebalance process(es) and client(s). So, there is equal probability that these locks might be requests from clients and hence application can see some file operations failing.<br>
<br>
In case of pulling plug on DHT_LAYOUT_HEAL_DOMAIN, dentry operations that depend on layout can fail. These operations can include create, link, unlink, symlink, mknod, mkdir, rename for files/directory within the directory on which lock request is failed.<br>
<br>
In case of pulling plug on DHT_FILE_MIGRATE_DOMAIN, rename of immediate subdirectories/files can fail.<br>
<div>
<div><br>
<br>
&gt;<br>
&gt; Richard<br>
&gt;<br>
&gt;<br>
&gt; Sent from my iPhone<br>
&gt;<br>
&gt; On Jan 24, 2016, at 6:42 PM, Pranith Kumar Karampuri &lt; <a href="mailto:pkarampu@redhat.com" target="_blank">
pkarampu@redhat.com</a> &gt;<br>
&gt; wrote:<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; On 01/25/2016 02:17 AM, Richard Wareing wrote:<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; Hello all,<br>
&gt;<br>
&gt; Just gave a talk at SCaLE 14x today and I mentioned our new locks revocation<br>
&gt; feature which has had a significant impact on our GFS cluster reliability.<br>
&gt; As such I wanted to share the patch with the community, so here&#39;s the<br>
&gt; bugzilla report:<br>
&gt;<br>
&gt; <a href="https://bugzilla.redhat.com/show_bug.cgi?id=1301401" rel="noreferrer" target="_blank">
https://bugzilla.redhat.com/show_bug.cgi?id=1301401</a><br>
&gt;<br>
&gt; =====<br>
&gt; Summary:<br>
&gt; Mis-behaving brick clients (gNFSd, FUSE, gfAPI) can cause cluster instability<br>
&gt; and eventual complete unavailability due to failures in releasing<br>
&gt; entry/inode locks in a timely manner.<br>
&gt;<br>
&gt; Classic symptoms on this are increased brick (and/or gNFSd) memory usage due<br>
&gt; the high number of (lock request) frames piling up in the processes. The<br>
&gt; failure-mode results in bricks eventually slowing down to a crawl due to<br>
&gt; swapping, or OOMing due to complete memory exhaustion; during this period<br>
&gt; the entire cluster can begin to fail. End-users will experience this as<br>
&gt; hangs on the filesystem, first in a specific region of the file-system and<br>
&gt; ultimately the entire filesystem as the offending brick begins to turn into<br>
&gt; a zombie (i.e. not quite dead, but not quite alive either).<br>
&gt;<br>
&gt; Currently, these situations must be handled by an administrator detecting &amp;<br>
&gt; intervening via the &quot;clear-locks&quot; CLI command. Unfortunately this doesn&#39;t<br>
&gt; scale for large numbers of clusters, and it depends on the correct<br>
&gt; (external) detection of the locks piling up (for which there is little<br>
&gt; signal other than state dumps).<br>
&gt;<br>
&gt; This patch introduces two features to remedy this situation:<br>
&gt;<br>
&gt; 1. Monkey-unlocking - This is a feature targeted at developers (only!) to<br>
&gt; help track down crashes due to stale locks, and prove the utility of he lock<br>
&gt; revocation feature. It does this by silently dropping 1% of unlock requests;<br>
&gt; simulating bugs or mis-behaving clients.<br>
&gt;<br>
&gt; The feature is activated via:<br>
&gt; features.locks-monkey-unlocking &lt;on/off&gt;<br>
&gt;<br>
&gt; You&#39;ll see the message<br>
&gt; &quot;[&lt;timestamp&gt;] W [inodelk.c:653:pl_inode_setlk] 0-groot-locks: MONKEY LOCKING<br>
&gt; (forcing stuck lock)!&quot; ... in the logs indicating a request has been<br>
&gt; dropped.<br>
&gt;<br>
&gt; 2. Lock revocation - Once enabled, this feature will revoke a *contended*lock<br>
&gt; (i.e. if nobody else asks for the lock, we will not revoke it) either by the<br>
&gt; amount of time the lock has been held, how many other lock requests are<br>
&gt; waiting on the lock to be freed, or some combination of both. Clients which<br>
&gt; are losing their locks will be notified by receiving EAGAIN (send back to<br>
&gt; their callback function).<br>
&gt;<br>
&gt; The feature is activated via these options:<br>
&gt; features.locks-revocation-secs &lt;integer; 0 to disable&gt;<br>
&gt; features.locks-revocation-clear-all [on/off]<br>
&gt; features.locks-revocation-max-blocked &lt;integer&gt;<br>
&gt;<br>
&gt; Recommended settings are: 1800 seconds for a time based timeout (give clients<br>
&gt; the benefit of the doubt, or chose a max-blocked requires some<br>
&gt; experimentation depending on your workload, but generally values of hundreds<br>
&gt; to low thousands (it&#39;s normal for many ten&#39;s of locks to be taken out when<br>
&gt; files are being written @ high throughput).<br>
&gt;<br>
&gt; I really like this feature. One question though, self-heal, rebalance domain<br>
&gt; locks are active until self-heal/rebalance is complete which can take more<br>
&gt; than 30 minutes if the files are in TBs. I will try to see what we can do to<br>
&gt; handle these without increasing the revocation-secs too much. May be we can<br>
&gt; come up with per domain revocation timeouts. Comments are welcome.<br>
&gt;<br>
&gt; Pranith<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; =====<br>
&gt;<br>
&gt; The patch supplied will patch clean the the v3.7.6 release tag, and probably<br>
&gt; to any 3.7.x release &amp; master (posix locks xlator is rarely touched).<br>
&gt;<br>
&gt; Richard<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Gluster-devel mailing list <a href="mailto:Gluster-devel@gluster.org" target="_blank">
Gluster-devel@gluster.org</a><br>
&gt; <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.gluster.org_mailman_listinfo_gluster-2Ddevel&amp;d=CwMFaQ&amp;c=5VD0RTtNlTh3ycd41b3MUw&amp;r=qJ8Lp7ySfpQklq3QZr44Iw&amp;m=PZGWfy5Y16_RQ1y2K73ShgTiHmTdeo4ZTHlPNp5ENd8&amp;s=hgqwXn2r8O02F2c4nk3ssRN_DNRBtaa7vsBxJbRwi1g&amp;e=" rel="noreferrer" target="_blank">
http://www.gluster.org/mailman/listinfo/gluster-devel</a><br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Gluster-devel mailing list<br>
&gt; <a href="mailto:Gluster-devel@gluster.org" target="_blank">Gluster-devel@gluster.org</a><br>
&gt; <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.gluster.org_mailman_listinfo_gluster-2Ddevel&amp;d=CwMFaQ&amp;c=5VD0RTtNlTh3ycd41b3MUw&amp;r=qJ8Lp7ySfpQklq3QZr44Iw&amp;m=PZGWfy5Y16_RQ1y2K73ShgTiHmTdeo4ZTHlPNp5ENd8&amp;s=hgqwXn2r8O02F2c4nk3ssRN_DNRBtaa7vsBxJbRwi1g&amp;e=" rel="noreferrer" target="_blank">
http://www.gluster.org/mailman/listinfo/gluster-devel</a><br>
_______________________________________________<br>
Gluster-devel mailing list<br>
<a href="mailto:Gluster-devel@gluster.org" target="_blank">Gluster-devel@gluster.org</a><br>
<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.gluster.org_mailman_listinfo_gluster-2Ddevel&amp;d=CwMFaQ&amp;c=5VD0RTtNlTh3ycd41b3MUw&amp;r=qJ8Lp7ySfpQklq3QZr44Iw&amp;m=PZGWfy5Y16_RQ1y2K73ShgTiHmTdeo4ZTHlPNp5ENd8&amp;s=hgqwXn2r8O02F2c4nk3ssRN_DNRBtaa7vsBxJbRwi1g&amp;e=" rel="noreferrer" target="_blank">http://www.gluster.org/mailman/listinfo/gluster-devel</a><br>
</div>
</div>
</blockquote>
</div>
<br>
<br clear="all">
<div><br>
</div>
-- <br>
<div>Raghavendra G<br>
</div>
</div>
</div>
</div>
</div></div></div>
</div>
</div>
</div>

<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" rel="noreferrer" target="_blank">http://www.gluster.org/mailman/listinfo/gluster-devel</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Raghavendra G<br></div>
</div></div>