WHATSNEW: Add release notes for Samba 3.6.20.
[Samba.git] / source3 / modules / vfs_aio_fork.c
blob4891cd223ff5876d917dc6c26e5654d0585df3f4
1 /*
2 * Simulate the Posix AIO using mmap/fork
4 * Copyright (C) Volker Lendecke 2008
5 * Copyright (C) Jeremy Allison 2010
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 #include "includes.h"
23 #include "system/filesys.h"
24 #include "system/shmem.h"
25 #include "smbd/smbd.h"
27 #ifndef MAP_FILE
28 #define MAP_FILE 0
29 #endif
31 struct mmap_area {
32 size_t size;
33 volatile void *ptr;
36 static int mmap_area_destructor(struct mmap_area *area)
38 munmap((void *)area->ptr, area->size);
39 return 0;
42 static struct mmap_area *mmap_area_init(TALLOC_CTX *mem_ctx, size_t size)
44 struct mmap_area *result;
45 int fd;
47 result = talloc(mem_ctx, struct mmap_area);
48 if (result == NULL) {
49 DEBUG(0, ("talloc failed\n"));
50 goto fail;
53 fd = open("/dev/zero", O_RDWR);
54 if (fd == -1) {
55 DEBUG(3, ("open(\"/dev/zero\") failed: %s\n",
56 strerror(errno)));
57 goto fail;
60 result->ptr = mmap(NULL, size, PROT_READ|PROT_WRITE,
61 MAP_SHARED|MAP_FILE, fd, 0);
62 if (result->ptr == MAP_FAILED) {
63 DEBUG(1, ("mmap failed: %s\n", strerror(errno)));
64 goto fail;
67 close(fd);
69 result->size = size;
70 talloc_set_destructor(result, mmap_area_destructor);
72 return result;
74 fail:
75 TALLOC_FREE(result);
76 return NULL;
79 struct rw_cmd {
80 size_t n;
81 SMB_OFF_T offset;
82 bool read_cmd;
85 struct rw_ret {
86 ssize_t size;
87 int ret_errno;
90 struct aio_child_list;
92 struct aio_child {
93 struct aio_child *prev, *next;
94 struct aio_child_list *list;
95 SMB_STRUCT_AIOCB *aiocb;
96 pid_t pid;
97 int sockfd;
98 struct fd_event *sock_event;
99 struct rw_ret retval;
100 struct mmap_area *map; /* ==NULL means write request */
101 bool dont_delete; /* Marked as in use since last cleanup */
102 bool cancelled;
103 bool read_cmd;
104 bool called_from_suspend;
105 bool completion_done;
108 struct aio_child_list {
109 struct aio_child *children;
110 struct timed_event *cleanup_event;
113 static void free_aio_children(void **p)
115 TALLOC_FREE(*p);
118 static ssize_t read_fd(int fd, void *ptr, size_t nbytes, int *recvfd)
120 struct msghdr msg;
121 struct iovec iov[1];
122 ssize_t n;
123 #ifndef HAVE_MSGHDR_MSG_CONTROL
124 int newfd;
125 #endif
127 #ifdef HAVE_MSGHDR_MSG_CONTROL
128 union {
129 struct cmsghdr cm;
130 char control[CMSG_SPACE(sizeof(int))];
131 } control_un;
132 struct cmsghdr *cmptr;
134 msg.msg_control = control_un.control;
135 msg.msg_controllen = sizeof(control_un.control);
136 #else
137 #if HAVE_MSGHDR_MSG_ACCTRIGHTS
138 msg.msg_accrights = (caddr_t) &newfd;
139 msg.msg_accrightslen = sizeof(int);
140 #else
141 #error Can not pass file descriptors
142 #endif
143 #endif
145 msg.msg_name = NULL;
146 msg.msg_namelen = 0;
148 iov[0].iov_base = (void *)ptr;
149 iov[0].iov_len = nbytes;
150 msg.msg_iov = iov;
151 msg.msg_iovlen = 1;
153 if ( (n = recvmsg(fd, &msg, 0)) <= 0) {
154 return(n);
157 #ifdef HAVE_MSGHDR_MSG_CONTROL
158 if ((cmptr = CMSG_FIRSTHDR(&msg)) != NULL
159 && cmptr->cmsg_len == CMSG_LEN(sizeof(int))) {
160 if (cmptr->cmsg_level != SOL_SOCKET) {
161 DEBUG(10, ("control level != SOL_SOCKET"));
162 errno = EINVAL;
163 return -1;
165 if (cmptr->cmsg_type != SCM_RIGHTS) {
166 DEBUG(10, ("control type != SCM_RIGHTS"));
167 errno = EINVAL;
168 return -1;
170 *recvfd = *((int *) CMSG_DATA(cmptr));
171 } else {
172 *recvfd = -1; /* descriptor was not passed */
174 #else
175 if (msg.msg_accrightslen == sizeof(int)) {
176 *recvfd = newfd;
178 else {
179 *recvfd = -1; /* descriptor was not passed */
181 #endif
183 return(n);
186 static ssize_t write_fd(int fd, void *ptr, size_t nbytes, int sendfd)
188 struct msghdr msg;
189 struct iovec iov[1];
191 #ifdef HAVE_MSGHDR_MSG_CONTROL
192 union {
193 struct cmsghdr cm;
194 char control[CMSG_SPACE(sizeof(int))];
195 } control_un;
196 struct cmsghdr *cmptr;
198 ZERO_STRUCT(msg);
199 ZERO_STRUCT(control_un);
201 msg.msg_control = control_un.control;
202 msg.msg_controllen = sizeof(control_un.control);
204 cmptr = CMSG_FIRSTHDR(&msg);
205 cmptr->cmsg_len = CMSG_LEN(sizeof(int));
206 cmptr->cmsg_level = SOL_SOCKET;
207 cmptr->cmsg_type = SCM_RIGHTS;
208 *((int *) CMSG_DATA(cmptr)) = sendfd;
209 #else
210 ZERO_STRUCT(msg);
211 msg.msg_accrights = (caddr_t) &sendfd;
212 msg.msg_accrightslen = sizeof(int);
213 #endif
215 msg.msg_name = NULL;
216 msg.msg_namelen = 0;
218 ZERO_STRUCT(iov);
219 iov[0].iov_base = (void *)ptr;
220 iov[0].iov_len = nbytes;
221 msg.msg_iov = iov;
222 msg.msg_iovlen = 1;
224 return (sendmsg(fd, &msg, 0));
227 static void aio_child_cleanup(struct event_context *event_ctx,
228 struct timed_event *te,
229 struct timeval now,
230 void *private_data)
232 struct aio_child_list *list = talloc_get_type_abort(
233 private_data, struct aio_child_list);
234 struct aio_child *child, *next;
236 TALLOC_FREE(list->cleanup_event);
238 for (child = list->children; child != NULL; child = next) {
239 next = child->next;
241 if (child->aiocb != NULL) {
242 DEBUG(10, ("child %d currently active\n",
243 (int)child->pid));
244 continue;
247 if (child->dont_delete) {
248 DEBUG(10, ("Child %d was active since last cleanup\n",
249 (int)child->pid));
250 child->dont_delete = false;
251 continue;
254 DEBUG(10, ("Child %d idle for more than 30 seconds, "
255 "deleting\n", (int)child->pid));
257 TALLOC_FREE(child);
258 child = next;
261 if (list->children != NULL) {
263 * Re-schedule the next cleanup round
265 list->cleanup_event = event_add_timed(smbd_event_context(), list,
266 timeval_add(&now, 30, 0),
267 aio_child_cleanup, list);
272 static struct aio_child_list *init_aio_children(struct vfs_handle_struct *handle)
274 struct aio_child_list *data = NULL;
276 if (SMB_VFS_HANDLE_TEST_DATA(handle)) {
277 SMB_VFS_HANDLE_GET_DATA(handle, data, struct aio_child_list,
278 return NULL);
281 if (data == NULL) {
282 data = TALLOC_ZERO_P(NULL, struct aio_child_list);
283 if (data == NULL) {
284 return NULL;
289 * Regardless of whether the child_list had been around or not, make
290 * sure that we have a cleanup timed event. This timed event will
291 * delete itself when it finds that no children are around anymore.
294 if (data->cleanup_event == NULL) {
295 data->cleanup_event = event_add_timed(smbd_event_context(), data,
296 timeval_current_ofs(30, 0),
297 aio_child_cleanup, data);
298 if (data->cleanup_event == NULL) {
299 TALLOC_FREE(data);
300 return NULL;
304 if (!SMB_VFS_HANDLE_TEST_DATA(handle)) {
305 SMB_VFS_HANDLE_SET_DATA(handle, data, free_aio_children,
306 struct aio_child_list, return False);
309 return data;
312 static void aio_child_loop(int sockfd, struct mmap_area *map)
314 while (true) {
315 int fd = -1;
316 ssize_t ret;
317 struct rw_cmd cmd_struct;
318 struct rw_ret ret_struct;
320 ret = read_fd(sockfd, &cmd_struct, sizeof(cmd_struct), &fd);
321 if (ret != sizeof(cmd_struct)) {
322 DEBUG(10, ("read_fd returned %d: %s\n", (int)ret,
323 strerror(errno)));
324 exit(1);
327 DEBUG(10, ("aio_child_loop: %s %d bytes at %d from fd %d\n",
328 cmd_struct.read_cmd ? "read" : "write",
329 (int)cmd_struct.n, (int)cmd_struct.offset, fd));
331 #ifdef ENABLE_BUILD_FARM_HACKS
334 * In the build farm, we want erratic behaviour for
335 * async I/O times
337 uint8_t randval;
338 unsigned msecs;
340 * use generate_random_buffer, we just forked from a
341 * common parent state
343 generate_random_buffer(&randval, sizeof(randval));
344 msecs = randval + 20;
345 DEBUG(10, ("delaying for %u msecs\n", msecs));
346 smb_msleep(msecs);
348 #endif
351 ZERO_STRUCT(ret_struct);
353 if (cmd_struct.read_cmd) {
354 ret_struct.size = sys_pread(
355 fd, (void *)map->ptr, cmd_struct.n,
356 cmd_struct.offset);
357 #if 0
358 /* This breaks "make test" when run with aio_fork module. */
359 #ifdef ENABLE_BUILD_FARM_HACKS
360 ret_struct.size = MAX(1, ret_struct.size * 0.9);
361 #endif
362 #endif
364 else {
365 ret_struct.size = sys_pwrite(
366 fd, (void *)map->ptr, cmd_struct.n,
367 cmd_struct.offset);
370 DEBUG(10, ("aio_child_loop: syscall returned %d\n",
371 (int)ret_struct.size));
373 if (ret_struct.size == -1) {
374 ret_struct.ret_errno = errno;
378 * Close the fd before telling our parent we're done. The
379 * parent might close and re-open the file very quickly, and
380 * with system-level share modes (GPFS) we would get an
381 * unjustified SHARING_VIOLATION.
383 close(fd);
385 ret = write_data(sockfd, (char *)&ret_struct,
386 sizeof(ret_struct));
387 if (ret != sizeof(ret_struct)) {
388 DEBUG(10, ("could not write ret_struct: %s\n",
389 strerror(errno)));
390 exit(2);
395 static void handle_aio_completion(struct event_context *event_ctx,
396 struct fd_event *event, uint16 flags,
397 void *p)
399 struct aio_extra *aio_ex = NULL;
400 struct aio_child *child = (struct aio_child *)p;
401 NTSTATUS status;
403 DEBUG(10, ("handle_aio_completion called with flags=%d\n", flags));
405 if ((flags & EVENT_FD_READ) == 0) {
406 return;
409 status = read_data(child->sockfd, (char *)&child->retval,
410 sizeof(child->retval));
412 if (!NT_STATUS_IS_OK(status)) {
413 DEBUG(1, ("aio child %d died: %s\n", (int)child->pid,
414 nt_errstr(status)));
415 child->retval.size = -1;
416 child->retval.ret_errno = EIO;
419 if (child->aiocb == NULL) {
420 DEBUG(1, ("Inactive child died\n"));
421 TALLOC_FREE(child);
422 return;
425 if (child->cancelled) {
426 child->aiocb = NULL;
427 child->cancelled = false;
428 return;
431 if (child->read_cmd && (child->retval.size > 0)) {
432 SMB_ASSERT(child->retval.size <= child->aiocb->aio_nbytes);
433 memcpy((void *)child->aiocb->aio_buf, (void *)child->map->ptr,
434 child->retval.size);
437 if (child->called_from_suspend) {
438 child->completion_done = true;
439 return;
441 aio_ex = (struct aio_extra *)child->aiocb->aio_sigevent.sigev_value.sival_ptr;
442 smbd_aio_complete_aio_ex(aio_ex);
443 TALLOC_FREE(aio_ex);
446 static int aio_child_destructor(struct aio_child *child)
448 char c=0;
450 SMB_ASSERT((child->aiocb == NULL) || child->cancelled);
452 DEBUG(10, ("aio_child_destructor: removing child %d on fd %d\n",
453 child->pid, child->sockfd));
456 * closing the sockfd makes the child not return from recvmsg() on RHEL
457 * 5.5 so instead force the child to exit by writing bad data to it
459 write(child->sockfd, &c, sizeof(c));
460 close(child->sockfd);
461 DLIST_REMOVE(child->list->children, child);
462 return 0;
466 * We have to close all fd's in open files, we might incorrectly hold a system
467 * level share mode on a file.
470 static struct files_struct *close_fsp_fd(struct files_struct *fsp,
471 void *private_data)
473 if ((fsp->fh != NULL) && (fsp->fh->fd != -1)) {
474 close(fsp->fh->fd);
475 fsp->fh->fd = -1;
477 return NULL;
480 static NTSTATUS create_aio_child(struct smbd_server_connection *sconn,
481 struct aio_child_list *children,
482 size_t map_size,
483 struct aio_child **presult)
485 struct aio_child *result;
486 int fdpair[2];
487 NTSTATUS status;
489 fdpair[0] = fdpair[1] = -1;
491 result = TALLOC_ZERO_P(children, struct aio_child);
492 NT_STATUS_HAVE_NO_MEMORY(result);
494 if (socketpair(AF_UNIX, SOCK_STREAM, 0, fdpair) == -1) {
495 status = map_nt_error_from_unix(errno);
496 DEBUG(10, ("socketpair() failed: %s\n", strerror(errno)));
497 goto fail;
500 DEBUG(10, ("fdpair = %d/%d\n", fdpair[0], fdpair[1]));
502 result->map = mmap_area_init(result, map_size);
503 if (result->map == NULL) {
504 status = map_nt_error_from_unix(errno);
505 DEBUG(0, ("Could not create mmap area\n"));
506 goto fail;
509 result->pid = sys_fork();
510 if (result->pid == -1) {
511 status = map_nt_error_from_unix(errno);
512 DEBUG(0, ("fork failed: %s\n", strerror(errno)));
513 goto fail;
516 if (result->pid == 0) {
517 close(fdpair[0]);
518 result->sockfd = fdpair[1];
519 files_forall(sconn, close_fsp_fd, NULL);
520 aio_child_loop(result->sockfd, result->map);
523 DEBUG(10, ("Child %d created with sockfd %d\n",
524 result->pid, fdpair[0]));
526 result->sockfd = fdpair[0];
527 close(fdpair[1]);
529 result->sock_event = event_add_fd(smbd_event_context(), result,
530 result->sockfd, EVENT_FD_READ,
531 handle_aio_completion,
532 result);
533 if (result->sock_event == NULL) {
534 status = NT_STATUS_NO_MEMORY;
535 DEBUG(0, ("event_add_fd failed\n"));
536 goto fail;
539 result->list = children;
540 DLIST_ADD(children->children, result);
542 talloc_set_destructor(result, aio_child_destructor);
544 *presult = result;
546 return NT_STATUS_OK;
548 fail:
549 if (fdpair[0] != -1) close(fdpair[0]);
550 if (fdpair[1] != -1) close(fdpair[1]);
551 TALLOC_FREE(result);
553 return status;
556 static NTSTATUS get_idle_child(struct vfs_handle_struct *handle,
557 struct aio_child **pchild)
559 struct aio_child_list *children;
560 struct aio_child *child;
561 NTSTATUS status;
563 children = init_aio_children(handle);
564 if (children == NULL) {
565 return NT_STATUS_NO_MEMORY;
568 for (child = children->children; child != NULL; child = child->next) {
569 if (child->aiocb == NULL) {
570 /* idle */
571 break;
575 if (child == NULL) {
576 DEBUG(10, ("no idle child found, creating new one\n"));
578 status = create_aio_child(handle->conn->sconn, children,
579 128*1024, &child);
580 if (!NT_STATUS_IS_OK(status)) {
581 DEBUG(10, ("create_aio_child failed: %s\n",
582 nt_errstr(status)));
583 return status;
587 child->dont_delete = true;
589 *pchild = child;
590 return NT_STATUS_OK;
593 static int aio_fork_read(struct vfs_handle_struct *handle,
594 struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
596 struct aio_child *child;
597 struct rw_cmd cmd;
598 ssize_t ret;
599 NTSTATUS status;
601 if (aiocb->aio_nbytes > 128*1024) {
602 /* TODO: support variable buffers */
603 errno = EINVAL;
604 return -1;
607 status = get_idle_child(handle, &child);
608 if (!NT_STATUS_IS_OK(status)) {
609 DEBUG(10, ("Could not get an idle child\n"));
610 return -1;
613 child->read_cmd = true;
614 child->aiocb = aiocb;
615 child->retval.ret_errno = EINPROGRESS;
617 ZERO_STRUCT(cmd);
618 cmd.n = aiocb->aio_nbytes;
619 cmd.offset = aiocb->aio_offset;
620 cmd.read_cmd = child->read_cmd;
622 DEBUG(10, ("sending fd %d to child %d\n", fsp->fh->fd,
623 (int)child->pid));
625 ret = write_fd(child->sockfd, &cmd, sizeof(cmd), fsp->fh->fd);
626 if (ret == -1) {
627 DEBUG(10, ("write_fd failed: %s\n", strerror(errno)));
628 return -1;
631 return 0;
634 static int aio_fork_write(struct vfs_handle_struct *handle,
635 struct files_struct *fsp, SMB_STRUCT_AIOCB *aiocb)
637 struct aio_child *child;
638 struct rw_cmd cmd;
639 ssize_t ret;
640 NTSTATUS status;
642 if (aiocb->aio_nbytes > 128*1024) {
643 /* TODO: support variable buffers */
644 errno = EINVAL;
645 return -1;
648 status = get_idle_child(handle, &child);
649 if (!NT_STATUS_IS_OK(status)) {
650 DEBUG(10, ("Could not get an idle child\n"));
651 return -1;
654 child->read_cmd = false;
655 child->aiocb = aiocb;
656 child->retval.ret_errno = EINPROGRESS;
658 memcpy((void *)child->map->ptr, (void *)aiocb->aio_buf,
659 aiocb->aio_nbytes);
661 ZERO_STRUCT(cmd);
662 cmd.n = aiocb->aio_nbytes;
663 cmd.offset = aiocb->aio_offset;
664 cmd.read_cmd = child->read_cmd;
666 DEBUG(10, ("sending fd %d to child %d\n", fsp->fh->fd,
667 (int)child->pid));
669 ret = write_fd(child->sockfd, &cmd, sizeof(cmd), fsp->fh->fd);
670 if (ret == -1) {
671 DEBUG(10, ("write_fd failed: %s\n", strerror(errno)));
672 return -1;
675 return 0;
678 static struct aio_child *aio_fork_find_child(struct vfs_handle_struct *handle,
679 SMB_STRUCT_AIOCB *aiocb)
681 struct aio_child_list *children;
682 struct aio_child *child;
684 children = init_aio_children(handle);
685 if (children == NULL) {
686 return NULL;
689 for (child = children->children; child != NULL; child = child->next) {
690 if (child->aiocb == aiocb) {
691 return child;
695 return NULL;
698 static ssize_t aio_fork_return_fn(struct vfs_handle_struct *handle,
699 struct files_struct *fsp,
700 SMB_STRUCT_AIOCB *aiocb)
702 struct aio_child *child = aio_fork_find_child(handle, aiocb);
704 if (child == NULL) {
705 errno = EINVAL;
706 DEBUG(0, ("returning EINVAL\n"));
707 return -1;
710 child->aiocb = NULL;
712 if (child->retval.size == -1) {
713 errno = child->retval.ret_errno;
716 return child->retval.size;
719 static int aio_fork_cancel(struct vfs_handle_struct *handle,
720 struct files_struct *fsp,
721 SMB_STRUCT_AIOCB *aiocb)
723 struct aio_child_list *children;
724 struct aio_child *child;
726 children = init_aio_children(handle);
727 if (children == NULL) {
728 errno = EINVAL;
729 return -1;
732 for (child = children->children; child != NULL; child = child->next) {
733 if (child->aiocb == NULL) {
734 continue;
736 if (child->aiocb->aio_fildes != fsp->fh->fd) {
737 continue;
739 if ((aiocb != NULL) && (child->aiocb != aiocb)) {
740 continue;
744 * We let the child do its job, but we discard the result when
745 * it's finished.
748 child->cancelled = true;
751 return AIO_CANCELED;
754 static int aio_fork_error_fn(struct vfs_handle_struct *handle,
755 struct files_struct *fsp,
756 SMB_STRUCT_AIOCB *aiocb)
758 struct aio_child *child = aio_fork_find_child(handle, aiocb);
760 if (child == NULL) {
761 errno = EINVAL;
762 return -1;
765 return child->retval.ret_errno;
768 static void aio_fork_suspend_timed_out(struct tevent_context *event_ctx,
769 struct tevent_timer *te,
770 struct timeval now,
771 void *private_data)
773 bool *timed_out = (bool *)private_data;
774 /* Remove this timed event handler. */
775 TALLOC_FREE(te);
776 *timed_out = true;
779 static int aio_fork_suspend(struct vfs_handle_struct *handle,
780 struct files_struct *fsp,
781 const SMB_STRUCT_AIOCB * const aiocb_array[],
782 int n,
783 const struct timespec *timeout)
785 struct aio_child_list *children = NULL;
786 TALLOC_CTX *frame = talloc_stackframe();
787 struct event_context *ev = NULL;
788 int i;
789 int ret = -1;
790 bool timed_out = false;
792 children = init_aio_children(handle);
793 if (children == NULL) {
794 errno = EINVAL;
795 goto out;
798 /* This is a blocking call, and has to use a sub-event loop. */
799 ev = event_context_init(frame);
800 if (ev == NULL) {
801 errno = ENOMEM;
802 goto out;
805 if (timeout) {
806 struct timeval tv = convert_timespec_to_timeval(*timeout);
807 struct tevent_timer *te = tevent_add_timer(ev,
808 frame,
809 timeval_current_ofs(tv.tv_sec,
810 tv.tv_usec),
811 aio_fork_suspend_timed_out,
812 &timed_out);
813 if (!te) {
814 errno = ENOMEM;
815 goto out;
819 for (i = 0; i < n; i++) {
820 struct aio_child *child = NULL;
821 const SMB_STRUCT_AIOCB *aiocb = aiocb_array[i];
823 if (!aiocb) {
824 continue;
828 * We're going to cheat here. We know that smbd/aio.c
829 * only calls this when it's waiting for every single
830 * outstanding call to finish on a close, so just wait
831 * individually for each IO to complete. We don't care
832 * what order they finish - only that they all do. JRA.
835 for (child = children->children; child != NULL; child = child->next) {
836 struct tevent_fd *event;
838 if (child->aiocb == NULL) {
839 continue;
841 if (child->aiocb->aio_fildes != fsp->fh->fd) {
842 continue;
844 if (child->aiocb != aiocb) {
845 continue;
848 if (child->aiocb->aio_sigevent.sigev_value.sival_ptr == NULL) {
849 continue;
852 event = event_add_fd(ev,
853 frame,
854 child->sockfd,
855 EVENT_FD_READ,
856 handle_aio_completion,
857 child);
859 child->called_from_suspend = true;
861 while (!child->completion_done) {
862 if (tevent_loop_once(ev) == -1) {
863 goto out;
866 if (timed_out) {
867 errno = EAGAIN;
868 goto out;
874 ret = 0;
876 out:
878 TALLOC_FREE(frame);
879 return ret;
882 static struct vfs_fn_pointers vfs_aio_fork_fns = {
883 .aio_read = aio_fork_read,
884 .aio_write = aio_fork_write,
885 .aio_return_fn = aio_fork_return_fn,
886 .aio_cancel = aio_fork_cancel,
887 .aio_error_fn = aio_fork_error_fn,
888 .aio_suspend = aio_fork_suspend,
891 NTSTATUS vfs_aio_fork_init(void);
892 NTSTATUS vfs_aio_fork_init(void)
894 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
895 "aio_fork", &vfs_aio_fork_fns);