[PATCH] Make server-side copy (copy-chunk) async

Ralph Böhme slow at samba.org
Thu Mar 23 17:39:46 UTC 2017


On Thu, Mar 23, 2017 at 06:11:59AM -0700, Jeremy Allison wrote:
> On Thu, Mar 23, 2017 at 10:39:24AM +0100, Stefan Metzmacher wrote:
> > 
> > The fact that the cancel function passed
> > to tevent_req_set_cancel_fn() only gets the
> > tevent_req *req pointer, makes it impossible to write a generic
> > helper function on top of tevent.
> 
> So is it time for a tevent_req_set_cancel_fn_ex() that
> allows a private pointer to be passed as well ?
> 
> Might that be a better/more general solution ?

That can already be done by putting the private pointer into the state of the
request, so I don't see a real benefit here.

> 
> > I think tevent_req_set_cancel_forwarding() is easy to use for
> > all trivial cases where we do non parallel requests, which
> > is the majority of all use cases.
> > 
> > If someone has a more complex situation, it's only solvable
> > via a custom cancel function.
> 
> OK, it's just a little ugly IMHO. As I said, I
> can live with it :-).

Thanks!

metze pointed out that the patch doesn't handle cancellation semantics
correctly: from an MS-SMB2/MS-FSA/Windows behaviour perspective, cancellation
means removing a pending request that is not yet in progress. As soon as a
request in in-progress it must not be cancelled.

This is somewhat unfortunate as I definitely want to be able to cancle a
fruit:copyfile 1 TB file in-progress copy, at least in theory (as mentioned, the
client doesn't send a SMB2 cancel even though it has cancel button in the
progress window). We might return something like NT_STATUS_REQUEST_ABORTED for
this case, but we must not return NT_STATUS_CANCELLED.

Working on it, getting it right probably involves making pthreadpool_tevent jobs
cancellable, I have WIP patchset for this in my WIP branch:

<https://git.samba.org/?p=slow/samba.git;a=shortlog;h=refs/heads/async-cc>

This one has the core logic for allowing jobs to be cancelled as long as their
still waiting:

<https://git.samba.org/?p=slow/samba.git;a=commitdiff;h=1b91cdb62aa7078567fd96adeada3b5ad3731c48>

To be clear: this does not attempt to cancel worker threads that are alreay
running. That would be "aborting", not cancelling in spec terms and is not
needed.

Cheerio!
-slow



More information about the samba-technical mailing list