<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" id="owaParaStyle"></style>
</head>
<body fpstyle="1" ocsi="0">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">
<div>Greetings,</div>
<div><br>
</div>
<div>Trying the new list here, in the interest of having a bit more conversation and</div>
<div>design in the open.</div>
<div><br>
</div>
<div>I've been continuing work on lock ahead, and I've run in to a pair of related</div>
<div>problems I wanted to ask about.  I'll do them in two separate mails.</div>
<div><br>
</div>
<div>Basically, these center around ldlm_completion_ast/ldlm_completion_ast_async</div>
<div>and the LVB ready flag.</div>
<div><br>
</div>
<div>Here's the first one.</div>
<div><br>
</div>
<div>Because the reply to an async request is handled by the PTLRPCD thread,</div>
<div>async lock requests cannot use ldlm_completion_ast, because</div>
<div>(as Oleg so memorably told us in Denver) <span style="font-size: 10pt;">we can't sleep in ptlrpcd threads.</span></div>
<div><br>
</div>
<div>So I use ldlm_completion_ast_async for the lock ahead locks.  </div>
<div>The problem is, now, all of the users who attempt to use the lock will use that AST.</div>
<div><br>
</div>
<div>That's a problem, because ldlm_completion_ast is where a thread that wants to</div>
<div>use a lock on the waiting queue sleeps until that lock is granted.</div>
<div>So if a lock ahead lock is on the waiting queue and another thread finds it in</div>
<div>ldlm_lock_match, that thread calls ldlm_completion_ast_async, and does not sleep(!)</div>
<div>waiting for the lock to be granted.</div>
<div><br>
</div>
<div>My first thought for how to solve this is having a separate l_completion_ast_async</div>
<div>pointer.  The only caller that needs (and should get) the async behavior is ptlrpcd</div>
<div>via osc_enqueue_interpret, so it can call that instead of l_completion_ast.</div>
<div><br>
</div>
<div>ptlrpcd uses osc_enqueue_interpret, which calls ldlm_cli_enqueue_fini, which then calls</div>
<div>l_completion_ast.  I think it would be enough to add an "async" argument to</div>
<div>ldlm_cli_enqueue_fini, and have osc_enqueue_interpret use that to make ldlm_cli_enqueue_fini</div>
<div>call l_completion_ast_async instead.</div>
<div><br>
</div>
<div>This would allow other users to wait correctly for lock ahead locks <span style="font-size: 10pt;">to be granted.</span></div>
<div><br>
</div>
<div>Code implementing that will be going up shortly.  (I've tested it briefly and it seems to</div>
<div>work.)</div>
<div><br>
</div>
<div>Does that seem reasonable?  Is there another way it would be better to approach that one?</div>
<div><br>
</div>
<div>Other question (which is a bit nastier) coming shortly.</div>
<div><br>
</div>
<div>Thanks in advance,</div>
<div>- Patrick Farrell</div>
</div>
</body>
</html>