<br><br><div class="gmail_quote">On Wed, May 2, 2012 at 3:55 AM, Xavier Hernandez <span dir="ltr">&lt;<a href="mailto:xhernandez@datalab.es" target="_blank">xhernandez@datalab.es</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hello,<br>
<br>
I&#39;m wondering if there are any requisites that translators must satisfy to work correctly inside glusterfs.<br>
<br>
In particular I need to know two things:<br>
<br>
1. Are translators required to respect the order in which they receive the requests ?<br>
<br>
This is specially important in translators such as performance/io-threads or caching ones. It seems that these translators can reorder requests. If this is the case, is there any way to force some order between requests ? can inodelk/entrylk be used to force the order ?<br>

<br></blockquote><div><br></div><div>Translators are not expected to maintain ordering of requests. The only translator which takes care of ordering calls is write-behind. After acknowledging back write requests it has to make sure future requests see the true &quot;effect&quot; as though the previous write actually completed. To that end, it queues future &quot;dependent&quot; requests till the write acknowledgement is received from the server.</div>
<div><br></div><div>inodelk/entrylk calls help achieve synchronization among clients (by getting into a critical section) - just like a mutex. It is an arbitrator. It does not help for ordering of two calls. If one call must strictly complete after another call from your translator&#39;s point of view (i.e, if it has such a requirement), then the latter call&#39;s STACK_WIND must happen in the callback of the former&#39;s STACK_UNWIND path. There are no guarantees maintained by the system to ensure that a second STACK_WIND issued right after a first STACK_WIND will complete and callback in the same order. Write-behind does all its ordering gimmicks only because it STACK_UNWINDs a write call prematurely and therefore must maintain the causal effects by means of queueing new requests behind the downcall towards the server.</div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
2. Are translators required to propagate callback arguments even if the result of the operation is an error ? and if an internal translator error occurs ?<br>
<br></blockquote><div><br></div><div>Usually no. If op_ret is -1, only op_errno is expected to be a usable value. Rest of the callback parameters are junk.</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

When a translator has multiple subvolumes, I&#39;ve seen that some arguments, such as xdata, are replaced with NULL. This can be understood, but are regular translators (those that only have one subvolume) allowed to do that or must they preserve the value of xdata, even in the case of an internal error ?<br>

<br></blockquote><div><br></div><div>It is best to preserve the arguments unless you know specifically what you are doing. In case of error, all the non-op_{ret,errno} arguments are typically junk, including xdata.</div>
<div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
If this is not a requisite, xdata loses it&#39;s function of delivering back extra information.<br>
<br></blockquote><div><br></div><div>Can you explain? Are you seeing a use case for having a valid xdata in the callback even with op_ret == -1?</div><div><br></div><div>Thanks,</div><div><br></div><div>Avati</div><div><br>
</div></div>