vfs_glusterfs: use tevent_req_defer_callback() in order to use the correct event...
authorStefan Metzmacher <metze@samba.org>
Wed, 23 May 2018 06:53:47 +0000 (08:53 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 14 Jun 2018 18:52:23 +0000 (20:52 +0200)
The callback and _recv() functions should be called from the same
event context that was passed to the _send() function.

In future the completion pipe should be replaced by
tevent_threaded_context_create()

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_glusterfs.c

index 985a895257fe0069b665f1f914255fc5eb1986da..c2af793016f208404b397fc44e2289714504131e 100644 (file)
@@ -803,6 +803,14 @@ static struct tevent_req *vfs_gluster_pread_send(struct vfs_handle_struct
                return tevent_req_post(req, ev);
        }
 
+       /*
+        * aio_glusterfs_done and aio_tevent_fd_done()
+        * use the raw tevent context. We need to use
+        * tevent_req_defer_callback() in order to
+        * use the event context we're started with.
+        */
+       tevent_req_defer_callback(req, ev);
+
        PROFILE_TIMESTAMP(&state->start);
        ret = glfs_pread_async(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle,
                                fsp), data, n, offset, 0, aio_glusterfs_done,
@@ -839,6 +847,14 @@ static struct tevent_req *vfs_gluster_pwrite_send(struct vfs_handle_struct
                return tevent_req_post(req, ev);
        }
 
+       /*
+        * aio_glusterfs_done and aio_tevent_fd_done()
+        * use the raw tevent context. We need to use
+        * tevent_req_defer_callback() in order to
+        * use the event context we're started with.
+        */
+       tevent_req_defer_callback(req, ev);
+
        PROFILE_TIMESTAMP(&state->start);
        ret = glfs_pwrite_async(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle,
                                fsp), data, n, offset, 0, aio_glusterfs_done,
@@ -941,6 +957,14 @@ static struct tevent_req *vfs_gluster_fsync_send(struct vfs_handle_struct
                return tevent_req_post(req, ev);
        }
 
+       /*
+        * aio_glusterfs_done and aio_tevent_fd_done()
+        * use the raw tevent context. We need to use
+        * tevent_req_defer_callback() in order to
+        * use the event context we're started with.
+        */
+       tevent_req_defer_callback(req, ev);
+
        PROFILE_TIMESTAMP(&state->start);
        ret = glfs_fsync_async(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle,
                                fsp), aio_glusterfs_done, state);