Thanks for your answer.

On Saturday, 5 November 2022, at 3:09 PM, ori wrote:
The Tflush was successful: The Rflush does not indicate that a message was cancelled, tit indicates that the server is no longer processing the request.

After your answer an read the manual pages a few times again and now I understand what to do :

1) All Tflush messages get a Rflush reply. If more than one Tflush arrives answering the last one means responding to all of them, like the manual states here :

"A Rflush for any of the multiple Tflushes implies an answer for all previous ones. Therefore, should a server receive a request and then multiple flushes for that request, it need respond only to the last flush."

2)Even when oldtag doesn't represent an active message Tflush gets a Rflush response.

3) The only indicator for the client if his Tflush didn't interrupt (!!!) an active message cycle is (manual page) :

If a response to the flushed request is received before the Rflush, the client must honor the response as if it had not been flushed, since the completed request may signify a state change in the server. For instance, Tcreate may have created a file and Twalk may have allocated a fid. If no response is received before the Rflush, the flushed transaction is considered to have been canceled, and should be treated as though it had never been sent.

interpreted as :

a) Server replies to oldtag before sending Rflush ==> indicates oldtag wasn't interrupted
b) Server sends Rflush before responding to oldtag ==> indicates oldtag-message was interrupted

4) Its legal that a client sends Tflush messages with an invalid oldtag for which it can expect an Rflush as response never an Rerror (manual) :

The server should answer the flush message immediately. If it recognizes oldtag as the tag of a pending transaction, it should abort any pending response and discard that tag. In either case, it should respond with an Rflush echoing the tag (not oldtag) of the Tflush message. A Tflush can never be responded to by an Rerror message.


Now my interpretation of Tflush and Rflush quite changed :

It seems that Tflush has at least two functions :

(1) Interrupt a running message, while the probability to interrupt a running message is very small.
(2) Polling the fileserver and guessing how it is implemented. A server with a simple sequential message processiong won't be able to respond to a Tflush by Rflush before responding to oldtag. A server which only replies to the n-th Tflush would be lagging and uses a message queue.

Consequences for my implementation :

1) Its not an error if Tflush uses an invalid oldtag even using the ntag of Tflush as oldtag would be valid.
2) Every Tflush gets an Rflush directly or indirectly (response to the last in a series is enough)
3) Tflush can be used/abused to measure the fileserver performance. Send a message and flush it to measure the time needed to process it. Send n messages and measure the response time-differences, aso.
4) Tflush is not related with transactions but has to be taken as a rollback if sent for an oldtag that interrupts a running write operation.


Thanks ori for your clear answers i got the right hints to check my understanding. And I had a misunderstanding regarding tflush till now so I needed to ask ;)