smbd: use async dos_mode_at_send in smbd_smb2_query_directory_send()
[samba.git] / source3 / modules / vfs_glusterfs.c
index 985a895257fe0069b665f1f914255fc5eb1986da..431f6fff48c02d08268003f0df3b981b510af2a0 100644 (file)
@@ -362,6 +362,11 @@ static int vfs_gluster_connect(struct vfs_handle_struct *handle,
         */
        lp_do_parameter(SNUM(handle->conn), "shadow:mountpoint", "/");
 
+       /*
+        * Unless we have an async implementation of getxattrat turn this off.
+        */
+       lp_do_parameter(SNUM(handle->conn), "smbd:async dosmode", "false");
+
 done:
        if (ret < 0) {
                if (fs)
@@ -729,7 +734,16 @@ static bool init_gluster_aio(struct vfs_handle_struct *handle)
        read_fd = fds[0];
        write_fd = fds[1];
 
-       aio_read_event = tevent_add_fd(handle->conn->sconn->ev_ctx,
+       /*
+        * We use the raw tevent context here,
+        * as this is a global event handler.
+        *
+        * The tevent_req_defer_callback()
+        * calls will make sure the results
+        * of async calls are propagated
+        * to the correct tevent_context.
+        */
+       aio_read_event = tevent_add_fd(handle->conn->sconn->raw_ev_ctx,
                                        NULL,
                                        read_fd,
                                        TEVENT_FD_READ,
@@ -803,6 +817,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 +861,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 +971,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);
@@ -1509,6 +1547,8 @@ static struct vfs_fn_pointers glusterfs_fns = {
 
        /* EA Operations */
        .getxattr_fn = vfs_gluster_getxattr,
+       .getxattrat_send_fn = vfs_not_implemented_getxattrat_send,
+       .getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv,
        .fgetxattr_fn = vfs_gluster_fgetxattr,
        .listxattr_fn = vfs_gluster_listxattr,
        .flistxattr_fn = vfs_gluster_flistxattr,