<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
</head>
<body>
Yes, I assume its a comment about stack usage (or even more out of date and unrelated to the current code entirely. :p)&nbsp; Like you, I cant imagine what else it would be...<br>
<br>
Youre probably right about the locking issue, Im happy to defer.&nbsp; (In any case, this timed out path should be very far from hot...)<br>
<br>
Otherwise that fix looks good.&nbsp; Ill review the rest of these tomorrow.<br>
<br>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> NeilBrown &lt;neilb@suse.com&gt;<br>
<b>Sent:</b> Monday, February 12, 2018 6:17:22 PM<br>
<b>To:</b> Patrick Farrell; Oleg Drokin; Andreas Dilger; James Simmons; Greg Kroah-Hartman<br>
<b>Cc:</b> lkml; lustre<br>
<b>Subject:</b> Re: [lustre-devel] [PATCH 08/19] staging: lustre: simplify waiting in ldlm_completion_ast()</font>
<div>&nbsp;</div>
</div>
<div class="BodyFragment"><font size="2"><span style="font-size:11pt;">
<div class="PlainText">On Mon, Feb 12 2018, Patrick Farrell wrote:<br>
<br>
&gt; Neil,<br>
&gt;<br>
&gt; I didn't get anything after 8/19 in this series.&nbsp; Is this just me?&nbsp; (I'd keep waiting, except I also found a few things in this patch.)<br>
<br>
Not just you.&nbsp; My fault.&nbsp; They are appearing now.<br>
<br>
&gt;<br>
&gt; Minor:<br>
&gt; The line XXX ALLOCATE is out of date and could go.&nbsp; (It refers to a<br>
&gt; mix of things you eliminated and things that were already gone.)<br>
<br>
What does the line even mean?&nbsp; Some comment about stack usage?<br>
I think we have a look that looks for large stack frames.&nbsp; I wonder how<br>
to run it...<br>
<br>
&gt;<br>
&gt; Less minor:<br>
&gt; You remove use of the imp_lock when reading the connection count.&nbsp; While that'll work on x86, it's probably wrong on some architecture to read that without taking the lock...?<br>
<br>
It was my understanding that on all architectures which Linux support, a<br>
32bit aligned read is atomic wrt any 32bit write.&nbsp; I have trouble imagining how<br>
it could be otherwise.<br>
<br>
I probably should have highlighted the removal of the spinlock in the<br>
patch description though - it was intentional.<br>
<br>
&gt;<br>
&gt; Bug:<br>
&gt; The existing code uses the imp_conn_cnt from *before* the wait, rather<br>
&gt; than after.&nbsp; I think that's quite important.&nbsp; So you'll want to read<br>
&gt; it out before the wait.&nbsp; I think the main reason we'd hit the timeout<br>
&gt; is a disconnect, which should cause a reconnect, so it's very<br>
&gt; important to use the value from *before* the wait.&nbsp; (See comment on<br>
&gt; ptlrpc_set_import_discon for more of an explanation.&nbsp; Basically it's<br>
&gt; tracking a connection 'epoch', if it's changed, someone else already<br>
&gt; went through the reconnect code for this 'connection epoch' and we<br>
&gt; shouldn't start that process.) <br>
&gt;<br>
<br>
That wasn't intentional though - thanks for catching!<br>
Looking at&nbsp; ptlrpc_set_import_discon(), which is where the number<br>
eventually gets used, it is only used to compare with the new value of<br>
imp-&gt;imp_conn_cnt. <br>
<br>
This would fix both (assuming the locking issue needs fixing).<br>
<br>
Thanks,<br>
NeilBrown<br>
<br>
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c<br>
index f1233d844bbd..c3c9186b74ce 100644<br>
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_request.c<br>
&#43;&#43;&#43; b/drivers/staging/lustre/lustre/ldlm/ldlm_request.c<br>
@@ -103,7 &#43;103,7 @@ static int ldlm_request_bufsize(int count, int type)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return sizeof(struct ldlm_request) &#43; avail;<br>
&nbsp;}<br>
&nbsp;<br>
-static void ldlm_expired_completion_wait(struct ldlm_lock *lock, struct obd_import *imp2)<br>
&#43;static void ldlm_expired_completion_wait(struct ldlm_lock *lock, __u32 conn_cnt)<br>
&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct obd_import *imp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct obd_device *obd;<br>
@@ -129,7 &#43;129,7 @@ static void ldlm_expired_completion_wait(struct ldlm_lock *lock, struct obd_impo<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; obd = lock-&gt;l_conn_export-&gt;exp_obd;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; imp = obd-&gt;u.cli.cl_import;<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ptlrpc_fail_import(imp, imp2 ? imp2-&gt;imp_conn_cnt : 0);<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ptlrpc_fail_import(imp, conn_cnt);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; LDLM_ERROR(lock,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;lock timed out (enqueued at %lld, %llds ago), entering recovery for %s@%s&quot;,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; (s64)lock-&gt;l_last_activity,<br>
@@ -241,6 &#43;241,7 @@ int ldlm_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct obd_device *obd;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; struct obd_import *imp = NULL;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; __u32 timeout;<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; __u32 conn_cnt = 0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int rc = 0;<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (flags == LDLM_FL_WAIT_NOREPROC) {<br>
@@ -268,6 &#43;269,11 @@ int ldlm_completion_ast(struct ldlm_lock *lock, __u64 flags, void *data)<br>
&nbsp;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lock-&gt;l_last_activity = ktime_get_real_seconds();<br>
&nbsp;<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (imp) {<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; spin_lock(&amp;imp-&gt;imp_lock);<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; conn_cnt = imp-&gt;imp_conn_cnt;<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; spin_unlock(&amp;imp-&gt;imp_lock);<br>
&#43;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (OBD_FAIL_CHECK_RESET(OBD_FAIL_LDLM_INTR_CP_AST,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (rc == 0)<br>
-&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ldlm_expired_completion_wait(lock, imp);<br>
&#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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ldlm_expired_completion_wait(lock, conn_cnt);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /* Now wait abortable */<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (rc == 0)<br>
</div>
</span></font></div>
</body>
</html>