From: Jeremy Allison Date: Fri, 28 Feb 2020 23:53:19 +0000 (-0800) Subject: s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_pwrite_state as the callback data... X-Git-Tag: ldb-2.2.0~1497 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3357a77d0823eddc1b0db68cfa251a0d54058c88;p=thirdparty%2Fsamba.git s3: VFS: vfs_glusterfs. Pass in struct vfs_gluster_pwrite_state as the callback data to the subreq. Find the req we're finishing off by looking inside vfs_gluster_pwrite_state. In a shutdown close the caller calls talloc_free(req), so we can't access it directly as callback data. The next commit will NULL out the vfs_gluster_pwrite_state->req pointer when a caller calls talloc_free(req), and the request is still in flight. BUG: https://bugzilla.samba.org/show_bug.cgi?id=14301 Signed-off-by: Jeremy Allison Reviewed-by: Volker Lendecke --- diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 456e0c8a498..52c33725b8d 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -926,7 +926,7 @@ static struct tevent_req *vfs_gluster_pwrite_send(struct vfs_handle_struct if (tevent_req_nomem(subreq, req)) { return tevent_req_post(req, ev); } - tevent_req_set_callback(subreq, vfs_gluster_pwrite_done, req); + tevent_req_set_callback(subreq, vfs_gluster_pwrite_done, state); talloc_set_destructor(state, vfs_gluster_pwrite_state_destructor); @@ -972,10 +972,9 @@ static int vfs_gluster_pwrite_state_destructor(struct vfs_gluster_pwrite_state * static void vfs_gluster_pwrite_done(struct tevent_req *subreq) { - struct tevent_req *req = tevent_req_callback_data( - subreq, struct tevent_req); - struct vfs_gluster_pwrite_state *state = tevent_req_data( - req, struct vfs_gluster_pwrite_state); + struct vfs_gluster_pwrite_state *state = tevent_req_callback_data( + subreq, struct vfs_gluster_pwrite_state); + struct tevent_req *req = state->req; int ret; ret = pthreadpool_tevent_job_recv(subreq);