2 Unix SMB/CIFS implementation.
4 Wrap GlusterFS GFAPI calls in vfs functions.
6 Copyright (c) 2013 Anand Avati <avati@redhat.com>
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
23 * @file vfs_glusterfs.c
24 * @author Anand Avati <avati@redhat.com>
26 * @brief Samba VFS module for glusterfs
29 * - sendfile/recvfile support
31 * A Samba VFS module for GlusterFS, based on Gluster's libgfapi.
32 * This is a "bottom" vfs module (not something to be stacked on top of
33 * another module), and translates (most) calls to the closest actions
34 * available in libgfapi.
39 #include "smbd/smbd.h"
42 #include "lib/util/dlinklist.h"
43 #include "lib/util/tevent_unix.h"
44 #include "lib/tevent/tevent_internal.h"
45 #include "smbd/globals.h"
46 #include "lib/util/sys_rw.h"
48 #define DEFAULT_VOLFILE_SERVER "localhost"
50 static int read_fd = -1;
51 static int write_fd = -1;
52 static struct tevent_fd *aio_read_event = NULL;
55 * Helper to convert struct stat to struct stat_ex.
57 static void smb_stat_ex_from_stat(struct stat_ex *dst, const struct stat *src)
61 dst->st_ex_dev = src->st_dev;
62 dst->st_ex_ino = src->st_ino;
63 dst->st_ex_mode = src->st_mode;
64 dst->st_ex_nlink = src->st_nlink;
65 dst->st_ex_uid = src->st_uid;
66 dst->st_ex_gid = src->st_gid;
67 dst->st_ex_rdev = src->st_rdev;
68 dst->st_ex_size = src->st_size;
69 dst->st_ex_atime.tv_sec = src->st_atime;
70 dst->st_ex_mtime.tv_sec = src->st_mtime;
71 dst->st_ex_ctime.tv_sec = src->st_ctime;
72 dst->st_ex_btime.tv_sec = src->st_mtime;
73 dst->st_ex_blksize = src->st_blksize;
74 dst->st_ex_blocks = src->st_blocks;
76 dst->st_ex_atime.tv_nsec = src->st_atime_nsec;
77 dst->st_ex_mtime.tv_nsec = src->st_mtime_nsec;
78 dst->st_ex_ctime.tv_nsec = src->st_ctime_nsec;
79 dst->st_ex_btime.tv_nsec = src->st_mtime_nsec;
83 /* pre-opened glfs_t */
85 static struct glfs_preopened {
90 struct glfs_preopened *next, *prev;
94 static int glfs_set_preopened(const char *volume, const char *connectpath, glfs_t *fs)
96 struct glfs_preopened *entry = NULL;
98 entry = talloc_zero(NULL, struct glfs_preopened);
104 entry->volume = talloc_strdup(entry, volume);
105 if (!entry->volume) {
111 entry->connectpath = talloc_strdup(entry, connectpath);
112 if (entry->connectpath == NULL) {
121 DLIST_ADD(glfs_preopened, entry);
126 static glfs_t *glfs_find_preopened(const char *volume, const char *connectpath)
128 struct glfs_preopened *entry = NULL;
130 for (entry = glfs_preopened; entry; entry = entry->next) {
131 if (strcmp(entry->volume, volume) == 0 &&
132 strcmp(entry->connectpath, connectpath) == 0)
142 static void glfs_clear_preopened(glfs_t *fs)
144 struct glfs_preopened *entry = NULL;
146 for (entry = glfs_preopened; entry; entry = entry->next) {
147 if (entry->fs == fs) {
151 DLIST_REMOVE(glfs_preopened, entry);
153 glfs_fini(entry->fs);
159 /* Disk Operations */
161 static int vfs_gluster_connect(struct vfs_handle_struct *handle,
165 const char *volfile_server;
173 tmp_ctx = talloc_new(NULL);
174 if (tmp_ctx == NULL) {
178 logfile = lp_parm_talloc_string(tmp_ctx, SNUM(handle->conn), "glusterfs",
181 loglevel = lp_parm_int(SNUM(handle->conn), "glusterfs", "loglevel", -1);
183 volfile_server = lp_parm_const_string(SNUM(handle->conn), "glusterfs",
184 "volfile_server", NULL);
185 if (volfile_server == NULL) {
186 volfile_server = DEFAULT_VOLFILE_SERVER;
189 volume = lp_parm_const_string(SNUM(handle->conn), "glusterfs", "volume",
191 if (volume == NULL) {
195 fs = glfs_find_preopened(volume, handle->conn->connectpath);
200 fs = glfs_new(volume);
206 ret = glfs_set_volfile_server(fs, "tcp", volfile_server, 0);
208 DEBUG(0, ("Failed to set volfile_server %s\n", volfile_server));
212 ret = glfs_set_xlator_option(fs, "*-md-cache", "cache-posix-acl",
215 DEBUG(0, ("%s: Failed to set xlator options\n", volume));
220 ret = glfs_set_xlator_option(fs, "*-snapview-client",
221 "snapdir-entry-path",
222 handle->conn->connectpath);
224 DEBUG(0, ("%s: Failed to set xlator option:"
225 " snapdir-entry-path\n", volume));
230 ret = glfs_set_logging(fs, logfile, loglevel);
232 DEBUG(0, ("%s: Failed to set logfile %s loglevel %d\n",
233 volume, logfile, loglevel));
239 DEBUG(0, ("%s: Failed to initialize volume (%s)\n",
240 volume, strerror(errno)));
244 ret = glfs_set_preopened(volume, handle->conn->connectpath, fs);
246 DEBUG(0, ("%s: Failed to register volume (%s)\n",
247 volume, strerror(errno)));
251 talloc_free(tmp_ctx);
257 DEBUG(0, ("%s: Initialized volume from server %s\n",
258 volume, volfile_server));
264 static void vfs_gluster_disconnect(struct vfs_handle_struct *handle)
270 glfs_clear_preopened(fs);
273 static uint64_t vfs_gluster_disk_free(struct vfs_handle_struct *handle,
274 const char *path, uint64_t *bsize_p,
275 uint64_t *dfree_p, uint64_t *dsize_p)
277 struct statvfs statvfs = { 0, };
280 ret = glfs_statvfs(handle->data, path, &statvfs);
285 if (bsize_p != NULL) {
286 *bsize_p = (uint64_t)statvfs.f_bsize; /* Block size */
288 if (dfree_p != NULL) {
289 *dfree_p = (uint64_t)statvfs.f_bavail; /* Available Block units */
291 if (dsize_p != NULL) {
292 *dsize_p = (uint64_t)statvfs.f_blocks; /* Total Block units */
295 return (uint64_t)statvfs.f_bavail;
298 static int vfs_gluster_get_quota(struct vfs_handle_struct *handle,
300 enum SMB_QUOTA_TYPE qtype, unid_t id,
308 vfs_gluster_set_quota(struct vfs_handle_struct *handle,
309 enum SMB_QUOTA_TYPE qtype, unid_t id, SMB_DISK_QUOTA *qt)
315 static int vfs_gluster_statvfs(struct vfs_handle_struct *handle,
317 struct vfs_statvfs_struct *vfs_statvfs)
319 struct statvfs statvfs = { 0, };
322 ret = glfs_statvfs(handle->data, path, &statvfs);
324 DEBUG(0, ("glfs_statvfs(%s) failed: %s\n",
325 path, strerror(errno)));
329 ZERO_STRUCTP(vfs_statvfs);
331 vfs_statvfs->OptimalTransferSize = statvfs.f_frsize;
332 vfs_statvfs->BlockSize = statvfs.f_bsize;
333 vfs_statvfs->TotalBlocks = statvfs.f_blocks;
334 vfs_statvfs->BlocksAvail = statvfs.f_bfree;
335 vfs_statvfs->UserBlocksAvail = statvfs.f_bavail;
336 vfs_statvfs->TotalFileNodes = statvfs.f_files;
337 vfs_statvfs->FreeFileNodes = statvfs.f_ffree;
338 vfs_statvfs->FsIdentifier = statvfs.f_fsid;
339 vfs_statvfs->FsCapabilities =
340 FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
345 static uint32_t vfs_gluster_fs_capabilities(struct vfs_handle_struct *handle,
346 enum timestamp_set_resolution *p_ts_res)
348 uint32_t caps = FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
350 #ifdef STAT_HAVE_NSEC
351 *p_ts_res = TIMESTAMP_SET_NT_OR_BETTER;
357 static DIR *vfs_gluster_opendir(struct vfs_handle_struct *handle,
358 const struct smb_filename *smb_fname,
364 fd = glfs_opendir(handle->data, smb_fname->base_name);
366 DEBUG(0, ("glfs_opendir(%s) failed: %s\n",
367 smb_fname->base_name, strerror(errno)));
373 static DIR *vfs_gluster_fdopendir(struct vfs_handle_struct *handle,
374 files_struct *fsp, const char *mask,
377 return (DIR *) *(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp);
380 static int vfs_gluster_closedir(struct vfs_handle_struct *handle, DIR *dirp)
382 return glfs_closedir((void *)dirp);
385 static struct dirent *vfs_gluster_readdir(struct vfs_handle_struct *handle,
386 DIR *dirp, SMB_STRUCT_STAT *sbuf)
388 static char direntbuf[512];
391 struct dirent *dirent = 0;
394 ret = glfs_readdirplus_r((void *)dirp, &stat, (void *)direntbuf,
397 ret = glfs_readdir_r((void *)dirp, (void *)direntbuf, &dirent);
400 if ((ret < 0) || (dirent == NULL)) {
405 smb_stat_ex_from_stat(sbuf, &stat);
411 static long vfs_gluster_telldir(struct vfs_handle_struct *handle, DIR *dirp)
413 return glfs_telldir((void *)dirp);
416 static void vfs_gluster_seekdir(struct vfs_handle_struct *handle, DIR *dirp,
419 glfs_seekdir((void *)dirp, offset);
422 static void vfs_gluster_rewinddir(struct vfs_handle_struct *handle, DIR *dirp)
424 glfs_seekdir((void *)dirp, 0);
427 static void vfs_gluster_init_search_op(struct vfs_handle_struct *handle,
433 static int vfs_gluster_mkdir(struct vfs_handle_struct *handle,
434 const struct smb_filename *smb_fname,
437 return glfs_mkdir(handle->data, smb_fname->base_name, mode);
440 static int vfs_gluster_rmdir(struct vfs_handle_struct *handle,
441 const struct smb_filename *smb_fname)
443 return glfs_rmdir(handle->data, smb_fname->base_name);
446 static int vfs_gluster_open(struct vfs_handle_struct *handle,
447 struct smb_filename *smb_fname, files_struct *fsp,
448 int flags, mode_t mode)
453 if (flags & O_DIRECTORY) {
454 glfd = glfs_opendir(handle->data, smb_fname->base_name);
455 } else if (flags & O_CREAT) {
456 glfd = glfs_creat(handle->data, smb_fname->base_name, flags,
459 glfd = glfs_open(handle->data, smb_fname->base_name, flags);
465 p_tmp = (glfs_fd_t **)VFS_ADD_FSP_EXTENSION(handle, fsp,
468 /* An arbitrary value for error reporting, so you know its us. */
472 static int vfs_gluster_close(struct vfs_handle_struct *handle,
476 glfd = *(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp);
477 VFS_REMOVE_FSP_EXTENSION(handle, fsp);
478 return glfs_close(glfd);
481 static ssize_t vfs_gluster_read(struct vfs_handle_struct *handle,
482 files_struct *fsp, void *data, size_t n)
484 return glfs_read(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), data, n, 0);
487 static ssize_t vfs_gluster_pread(struct vfs_handle_struct *handle,
488 files_struct *fsp, void *data, size_t n,
491 return glfs_pread(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), data, n, offset, 0);
494 struct glusterfs_aio_state;
496 struct glusterfs_aio_wrapper {
497 struct glusterfs_aio_state *state;
500 struct glusterfs_aio_state {
502 struct tevent_req *req;
504 struct vfs_aio_state vfs_aio_state;
505 struct timespec start;
508 static int aio_wrapper_destructor(struct glusterfs_aio_wrapper *wrap)
510 if (wrap->state != NULL) {
511 wrap->state->cancelled = true;
518 * This function is the callback that will be called on glusterfs
519 * threads once the async IO submitted is complete. To notify
520 * Samba of the completion we use a pipe based queue.
522 static void aio_glusterfs_done(glfs_fd_t *fd, ssize_t ret, void *data)
524 struct glusterfs_aio_state *state = NULL;
528 state = (struct glusterfs_aio_state *)data;
530 clock_gettime_mono(&end);
534 state->vfs_aio_state.error = errno;
538 state->vfs_aio_state.duration = nsec_time_diff(&end, &state->start);
541 * Write the state pointer to glusterfs_aio_state to the
542 * pipe, so we can call tevent_req_done() from the main thread,
543 * because tevent_req_done() is not designed to be executed in
544 * the multithread environment, so tevent_req_done() must be
545 * executed from the smbd main thread.
547 * write(2) on pipes with sizes under _POSIX_PIPE_BUF
548 * in size is atomic, without this, the use op pipes in this
549 * code would not work.
551 * sys_write is a thin enough wrapper around write(2)
552 * that we can trust it here.
555 sts = sys_write(write_fd, &state, sizeof(struct glusterfs_aio_state *));
557 DEBUG(0,("\nWrite to pipe failed (%s)", strerror(errno)));
564 * Read each req off the pipe and process it.
566 static void aio_tevent_fd_done(struct tevent_context *event_ctx,
567 struct tevent_fd *fde,
568 uint16_t flags, void *data)
570 struct tevent_req *req = NULL;
571 struct glusterfs_aio_state *state = NULL;
575 * read(2) on pipes is atomic if the needed data is available
576 * in the pipe, per SUS and POSIX. Because we always write
577 * to the pipe in sizeof(struct tevent_req *) chunks, we can
578 * always read in those chunks, atomically.
580 * sys_read is a thin enough wrapper around read(2) that we
584 sts = sys_read(read_fd, &state, sizeof(struct glusterfs_aio_state *));
587 DEBUG(0,("\nRead from pipe failed (%s)", strerror(errno)));
590 /* if we've cancelled the op, there is no req, so just clean up. */
591 if (state->cancelled == true) {
599 tevent_req_done(req);
604 static bool init_gluster_aio(struct vfs_handle_struct *handle)
611 * Already initialized.
624 aio_read_event = tevent_add_fd(handle->conn->sconn->ev_ctx,
630 if (aio_read_event == NULL) {
636 TALLOC_FREE(aio_read_event);
646 static struct glusterfs_aio_state *aio_state_create(TALLOC_CTX *mem_ctx)
648 struct tevent_req *req = NULL;
649 struct glusterfs_aio_state *state = NULL;
650 struct glusterfs_aio_wrapper *wrapper = NULL;
652 req = tevent_req_create(mem_ctx, &wrapper, struct glusterfs_aio_wrapper);
658 state = talloc_zero(NULL, struct glusterfs_aio_state);
665 talloc_set_destructor(wrapper, aio_wrapper_destructor);
666 state->cancelled = false;
669 wrapper->state = state;
674 static struct tevent_req *vfs_gluster_pread_send(struct vfs_handle_struct
675 *handle, TALLOC_CTX *mem_ctx,
676 struct tevent_context *ev,
678 void *data, size_t n,
681 struct glusterfs_aio_state *state = NULL;
682 struct tevent_req *req = NULL;
685 state = aio_state_create(mem_ctx);
693 if (!init_gluster_aio(handle)) {
694 tevent_req_error(req, EIO);
695 return tevent_req_post(req, ev);
698 clock_gettime_mono(&state->start);
699 ret = glfs_pread_async(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle,
700 fsp), data, n, offset, 0, aio_glusterfs_done,
703 tevent_req_error(req, -ret);
704 return tevent_req_post(req, ev);
710 static struct tevent_req *vfs_gluster_pwrite_send(struct vfs_handle_struct
711 *handle, TALLOC_CTX *mem_ctx,
712 struct tevent_context *ev,
714 const void *data, size_t n,
717 struct glusterfs_aio_state *state = NULL;
718 struct tevent_req *req = NULL;
721 state = aio_state_create(mem_ctx);
729 if (!init_gluster_aio(handle)) {
730 tevent_req_error(req, EIO);
731 return tevent_req_post(req, ev);
734 clock_gettime_mono(&state->start);
735 ret = glfs_pwrite_async(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle,
736 fsp), data, n, offset, 0, aio_glusterfs_done,
739 tevent_req_error(req, -ret);
740 return tevent_req_post(req, ev);
746 static ssize_t vfs_gluster_recv(struct tevent_req *req,
747 struct vfs_aio_state *vfs_aio_state)
749 struct glusterfs_aio_wrapper *wrapper = NULL;
752 wrapper = tevent_req_data(req, struct glusterfs_aio_wrapper);
754 if (wrapper == NULL) {
758 if (wrapper->state == NULL) {
762 if (tevent_req_is_unix_error(req, &vfs_aio_state->error)) {
766 *vfs_aio_state = wrapper->state->vfs_aio_state;
767 ret = wrapper->state->ret;
769 /* Clean up the state, it is in a NULL context. */
771 TALLOC_FREE(wrapper->state);
776 static ssize_t vfs_gluster_write(struct vfs_handle_struct *handle,
777 files_struct *fsp, const void *data, size_t n)
779 return glfs_write(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), data, n, 0);
782 static ssize_t vfs_gluster_pwrite(struct vfs_handle_struct *handle,
783 files_struct *fsp, const void *data,
784 size_t n, off_t offset)
786 return glfs_pwrite(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), data, n, offset, 0);
789 static off_t vfs_gluster_lseek(struct vfs_handle_struct *handle,
790 files_struct *fsp, off_t offset, int whence)
792 return glfs_lseek(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), offset, whence);
795 static ssize_t vfs_gluster_sendfile(struct vfs_handle_struct *handle, int tofd,
796 files_struct *fromfsp,
797 const DATA_BLOB *hdr,
798 off_t offset, size_t n)
804 static ssize_t vfs_gluster_recvfile(struct vfs_handle_struct *handle,
805 int fromfd, files_struct *tofsp,
806 off_t offset, size_t n)
812 static int vfs_gluster_rename(struct vfs_handle_struct *handle,
813 const struct smb_filename *smb_fname_src,
814 const struct smb_filename *smb_fname_dst)
816 return glfs_rename(handle->data, smb_fname_src->base_name,
817 smb_fname_dst->base_name);
820 static int vfs_gluster_fsync(struct vfs_handle_struct *handle,
823 return glfs_fsync(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp));
826 static struct tevent_req *vfs_gluster_fsync_send(struct vfs_handle_struct
827 *handle, TALLOC_CTX *mem_ctx,
828 struct tevent_context *ev,
831 struct tevent_req *req = NULL;
832 struct glusterfs_aio_state *state = NULL;
835 state = aio_state_create(mem_ctx);
843 if (!init_gluster_aio(handle)) {
844 tevent_req_error(req, EIO);
845 return tevent_req_post(req, ev);
848 clock_gettime_mono(&state->start);
849 ret = glfs_fsync_async(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle,
850 fsp), aio_glusterfs_done, req);
852 tevent_req_error(req, -ret);
853 return tevent_req_post(req, ev);
858 static int vfs_gluster_fsync_recv(struct tevent_req *req,
859 struct vfs_aio_state *vfs_aio_state)
862 * Use implicit conversion ssize_t->int
864 return vfs_gluster_recv(req, vfs_aio_state);
867 static int vfs_gluster_stat(struct vfs_handle_struct *handle,
868 struct smb_filename *smb_fname)
873 ret = glfs_stat(handle->data, smb_fname->base_name, &st);
875 smb_stat_ex_from_stat(&smb_fname->st, &st);
877 if (ret < 0 && errno != ENOENT) {
878 DEBUG(0, ("glfs_stat(%s) failed: %s\n",
879 smb_fname->base_name, strerror(errno)));
884 static int vfs_gluster_fstat(struct vfs_handle_struct *handle,
885 files_struct *fsp, SMB_STRUCT_STAT *sbuf)
890 ret = glfs_fstat(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), &st);
892 smb_stat_ex_from_stat(sbuf, &st);
895 DEBUG(0, ("glfs_fstat(%d) failed: %s\n",
896 fsp->fh->fd, strerror(errno)));
901 static int vfs_gluster_lstat(struct vfs_handle_struct *handle,
902 struct smb_filename *smb_fname)
907 ret = glfs_lstat(handle->data, smb_fname->base_name, &st);
909 smb_stat_ex_from_stat(&smb_fname->st, &st);
911 if (ret < 0 && errno != ENOENT) {
912 DEBUG(0, ("glfs_lstat(%s) failed: %s\n",
913 smb_fname->base_name, strerror(errno)));
918 static uint64_t vfs_gluster_get_alloc_size(struct vfs_handle_struct *handle,
920 const SMB_STRUCT_STAT *sbuf)
922 return sbuf->st_ex_blocks * 512;
925 static int vfs_gluster_unlink(struct vfs_handle_struct *handle,
926 const struct smb_filename *smb_fname)
928 return glfs_unlink(handle->data, smb_fname->base_name);
931 static int vfs_gluster_chmod(struct vfs_handle_struct *handle,
932 const struct smb_filename *smb_fname,
935 return glfs_chmod(handle->data, smb_fname->base_name, mode);
938 static int vfs_gluster_fchmod(struct vfs_handle_struct *handle,
939 files_struct *fsp, mode_t mode)
941 return glfs_fchmod(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), mode);
944 static int vfs_gluster_chown(struct vfs_handle_struct *handle,
945 const char *path, uid_t uid, gid_t gid)
947 return glfs_chown(handle->data, path, uid, gid);
950 static int vfs_gluster_fchown(struct vfs_handle_struct *handle,
951 files_struct *fsp, uid_t uid, gid_t gid)
953 return glfs_fchown(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), uid, gid);
956 static int vfs_gluster_lchown(struct vfs_handle_struct *handle,
957 const char *path, uid_t uid, gid_t gid)
959 return glfs_lchown(handle->data, path, uid, gid);
962 static int vfs_gluster_chdir(struct vfs_handle_struct *handle, const char *path)
964 return glfs_chdir(handle->data, path);
967 static char *vfs_gluster_getwd(struct vfs_handle_struct *handle)
972 cwd = SMB_CALLOC_ARRAY(char, PATH_MAX);
977 ret = glfs_getcwd(handle->data, cwd, PATH_MAX - 1);
984 static int vfs_gluster_ntimes(struct vfs_handle_struct *handle,
985 const struct smb_filename *smb_fname,
986 struct smb_file_time *ft)
988 struct timespec times[2];
990 if (null_timespec(ft->atime)) {
991 times[0].tv_sec = smb_fname->st.st_ex_atime.tv_sec;
992 times[0].tv_nsec = smb_fname->st.st_ex_atime.tv_nsec;
994 times[0].tv_sec = ft->atime.tv_sec;
995 times[0].tv_nsec = ft->atime.tv_nsec;
998 if (null_timespec(ft->mtime)) {
999 times[1].tv_sec = smb_fname->st.st_ex_mtime.tv_sec;
1000 times[1].tv_nsec = smb_fname->st.st_ex_mtime.tv_nsec;
1002 times[1].tv_sec = ft->mtime.tv_sec;
1003 times[1].tv_nsec = ft->mtime.tv_nsec;
1006 if ((timespec_compare(×[0],
1007 &smb_fname->st.st_ex_atime) == 0) &&
1008 (timespec_compare(×[1],
1009 &smb_fname->st.st_ex_mtime) == 0)) {
1013 return glfs_utimens(handle->data, smb_fname->base_name, times);
1016 static int vfs_gluster_ftruncate(struct vfs_handle_struct *handle,
1017 files_struct *fsp, off_t offset)
1019 return glfs_ftruncate(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), offset);
1022 static int vfs_gluster_fallocate(struct vfs_handle_struct *handle,
1023 struct files_struct *fsp,
1025 off_t offset, off_t len)
1027 /* TODO: add support using glfs_fallocate() and glfs_zerofill() */
1032 static char *vfs_gluster_realpath(struct vfs_handle_struct *handle,
1035 return glfs_realpath(handle->data, path, 0);
1038 static bool vfs_gluster_lock(struct vfs_handle_struct *handle,
1039 files_struct *fsp, int op, off_t offset,
1040 off_t count, int type)
1042 struct flock flock = { 0, };
1045 flock.l_type = type;
1046 flock.l_whence = SEEK_SET;
1047 flock.l_start = offset;
1048 flock.l_len = count;
1051 ret = glfs_posix_lock(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), op, &flock);
1053 if (op == F_GETLK) {
1054 /* lock query, true if someone else has locked */
1056 (flock.l_type != F_UNLCK) &&
1057 (flock.l_pid != 0) && (flock.l_pid != getpid()))
1070 static int vfs_gluster_kernel_flock(struct vfs_handle_struct *handle,
1071 files_struct *fsp, uint32_t share_mode,
1072 uint32_t access_mask)
1078 static int vfs_gluster_linux_setlease(struct vfs_handle_struct *handle,
1079 files_struct *fsp, int leasetype)
1085 static bool vfs_gluster_getlock(struct vfs_handle_struct *handle,
1086 files_struct *fsp, off_t *poffset,
1087 off_t *pcount, int *ptype, pid_t *ppid)
1089 struct flock flock = { 0, };
1092 flock.l_type = *ptype;
1093 flock.l_whence = SEEK_SET;
1094 flock.l_start = *poffset;
1095 flock.l_len = *pcount;
1098 ret = glfs_posix_lock(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), F_GETLK, &flock);
1104 *ptype = flock.l_type;
1105 *poffset = flock.l_start;
1106 *pcount = flock.l_len;
1107 *ppid = flock.l_pid;
1112 static int vfs_gluster_symlink(struct vfs_handle_struct *handle,
1113 const char *oldpath, const char *newpath)
1115 return glfs_symlink(handle->data, oldpath, newpath);
1118 static int vfs_gluster_readlink(struct vfs_handle_struct *handle,
1119 const char *path, char *buf, size_t bufsiz)
1121 return glfs_readlink(handle->data, path, buf, bufsiz);
1124 static int vfs_gluster_link(struct vfs_handle_struct *handle,
1125 const char *oldpath, const char *newpath)
1127 return glfs_link(handle->data, oldpath, newpath);
1130 static int vfs_gluster_mknod(struct vfs_handle_struct *handle, const char *path,
1131 mode_t mode, SMB_DEV_T dev)
1133 return glfs_mknod(handle->data, path, mode, dev);
1136 static int vfs_gluster_chflags(struct vfs_handle_struct *handle,
1137 const char *path, unsigned int flags)
1143 static int vfs_gluster_get_real_filename(struct vfs_handle_struct *handle,
1144 const char *path, const char *name,
1145 TALLOC_CTX *mem_ctx, char **found_name)
1148 char key_buf[NAME_MAX + 64];
1149 char val_buf[NAME_MAX + 1];
1151 if (strlen(name) >= NAME_MAX) {
1152 errno = ENAMETOOLONG;
1156 snprintf(key_buf, NAME_MAX + 64,
1157 "glusterfs.get_real_filename:%s", name);
1159 ret = glfs_getxattr(handle->data, path, key_buf, val_buf, NAME_MAX + 1);
1161 if (errno == ENODATA) {
1167 *found_name = talloc_strdup(mem_ctx, val_buf);
1168 if (found_name[0] == NULL) {
1175 static const char *vfs_gluster_connectpath(struct vfs_handle_struct *handle,
1176 const char *filename)
1178 return handle->conn->connectpath;
1183 static ssize_t vfs_gluster_getxattr(struct vfs_handle_struct *handle,
1184 const char *path, const char *name,
1185 void *value, size_t size)
1187 return glfs_getxattr(handle->data, path, name, value, size);
1190 static ssize_t vfs_gluster_fgetxattr(struct vfs_handle_struct *handle,
1191 files_struct *fsp, const char *name,
1192 void *value, size_t size)
1194 return glfs_fgetxattr(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), name, value, size);
1197 static ssize_t vfs_gluster_listxattr(struct vfs_handle_struct *handle,
1198 const char *path, char *list, size_t size)
1200 return glfs_listxattr(handle->data, path, list, size);
1203 static ssize_t vfs_gluster_flistxattr(struct vfs_handle_struct *handle,
1204 files_struct *fsp, char *list,
1207 return glfs_flistxattr(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), list, size);
1210 static int vfs_gluster_removexattr(struct vfs_handle_struct *handle,
1211 const char *path, const char *name)
1213 return glfs_removexattr(handle->data, path, name);
1216 static int vfs_gluster_fremovexattr(struct vfs_handle_struct *handle,
1217 files_struct *fsp, const char *name)
1219 return glfs_fremovexattr(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), name);
1222 static int vfs_gluster_setxattr(struct vfs_handle_struct *handle,
1223 const char *path, const char *name,
1224 const void *value, size_t size, int flags)
1226 return glfs_setxattr(handle->data, path, name, value, size, flags);
1229 static int vfs_gluster_fsetxattr(struct vfs_handle_struct *handle,
1230 files_struct *fsp, const char *name,
1231 const void *value, size_t size, int flags)
1233 return glfs_fsetxattr(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), name, value, size,
1237 /* AIO Operations */
1239 static bool vfs_gluster_aio_force(struct vfs_handle_struct *handle,
1245 /* Offline Operations */
1247 static bool vfs_gluster_is_offline(struct vfs_handle_struct *handle,
1248 const struct smb_filename *fname,
1249 SMB_STRUCT_STAT *sbuf)
1254 static int vfs_gluster_set_offline(struct vfs_handle_struct *handle,
1255 const struct smb_filename *fname)
1264 Size = 4 (header) + N * 8 (entry)
1266 Offset Size Field (Little Endian)
1267 -------------------------------------
1270 4-5 2-byte Entry-1 tag
1271 6-7 2-byte Entry-1 perm
1272 8-11 4-byte Entry-1 id
1274 12-13 2-byte Entry-2 tag
1275 14-15 2-byte Entry-2 perm
1276 16-19 4-byte Entry-2 id
1282 /* header version */
1283 #define GLUSTER_ACL_VERSION 2
1286 #define GLUSTER_ACL_READ 0x04
1287 #define GLUSTER_ACL_WRITE 0x02
1288 #define GLUSTER_ACL_EXECUTE 0x01
1291 #define GLUSTER_ACL_UNDEFINED_TAG 0x00
1292 #define GLUSTER_ACL_USER_OBJ 0x01
1293 #define GLUSTER_ACL_USER 0x02
1294 #define GLUSTER_ACL_GROUP_OBJ 0x04
1295 #define GLUSTER_ACL_GROUP 0x08
1296 #define GLUSTER_ACL_MASK 0x10
1297 #define GLUSTER_ACL_OTHER 0x20
1299 #define GLUSTER_ACL_UNDEFINED_ID (-1)
1301 #define GLUSTER_ACL_HEADER_SIZE 4
1302 #define GLUSTER_ACL_ENTRY_SIZE 8
1304 #define GLUSTER_ACL_SIZE(n) (GLUSTER_ACL_HEADER_SIZE + (n * GLUSTER_ACL_ENTRY_SIZE))
1306 static SMB_ACL_T mode_to_smb_acls(const struct stat *mode, TALLOC_CTX *mem_ctx)
1308 struct smb_acl_t *result;
1312 result = sys_acl_init(mem_ctx);
1318 result->acl = talloc_array(result, struct smb_acl_entry, count);
1321 talloc_free(result);
1325 result->count = count;
1327 result->acl[0].a_type = SMB_ACL_USER_OBJ;
1328 result->acl[0].a_perm = (mode->st_mode & S_IRWXU) >> 6;;
1330 result->acl[1].a_type = SMB_ACL_GROUP_OBJ;
1331 result->acl[1].a_perm = (mode->st_mode & S_IRWXG) >> 3;;
1333 result->acl[2].a_type = SMB_ACL_OTHER;
1334 result->acl[2].a_perm = mode->st_mode & S_IRWXO;;
1339 static SMB_ACL_T gluster_to_smb_acl(const char *buf, size_t xattr_size,
1340 TALLOC_CTX *mem_ctx)
1344 struct smb_acl_entry *smb_ace;
1345 struct smb_acl_t *result;
1354 if (size < GLUSTER_ACL_HEADER_SIZE) {
1355 /* ACL should be at least as big as the header (4 bytes) */
1360 size -= GLUSTER_ACL_HEADER_SIZE; /* size of header = 4 bytes */
1362 if (size % GLUSTER_ACL_ENTRY_SIZE) {
1363 /* Size of entries must strictly be a multiple of
1364 size of an ACE (8 bytes)
1370 count = size / GLUSTER_ACL_ENTRY_SIZE;
1372 /* Version is the first 4 bytes of the ACL */
1373 if (IVAL(buf, 0) != GLUSTER_ACL_VERSION) {
1374 DEBUG(0, ("Unknown gluster ACL version: %d\n",
1378 offset = GLUSTER_ACL_HEADER_SIZE;
1380 result = sys_acl_init(mem_ctx);
1386 result->acl = talloc_array(result, struct smb_acl_entry, count);
1389 talloc_free(result);
1393 result->count = count;
1395 smb_ace = result->acl;
1397 for (i = 0; i < count; i++) {
1398 /* TAG is the first 2 bytes of an entry */
1399 tag = SVAL(buf, offset);
1402 /* PERM is the next 2 bytes of an entry */
1403 perm = SVAL(buf, offset);
1406 /* ID is the last 4 bytes of an entry */
1407 id = IVAL(buf, offset);
1411 case GLUSTER_ACL_USER:
1412 smb_ace->a_type = SMB_ACL_USER;
1414 case GLUSTER_ACL_USER_OBJ:
1415 smb_ace->a_type = SMB_ACL_USER_OBJ;
1417 case GLUSTER_ACL_GROUP:
1418 smb_ace->a_type = SMB_ACL_GROUP;
1420 case GLUSTER_ACL_GROUP_OBJ:
1421 smb_ace->a_type = SMB_ACL_GROUP_OBJ;
1423 case GLUSTER_ACL_OTHER:
1424 smb_ace->a_type = SMB_ACL_OTHER;
1426 case GLUSTER_ACL_MASK:
1427 smb_ace->a_type = SMB_ACL_MASK;
1430 DEBUG(0, ("unknown tag type %d\n", (unsigned int) tag));
1435 switch(smb_ace->a_type) {
1437 smb_ace->info.user.uid = id;
1440 smb_ace->info.group.gid = id;
1446 smb_ace->a_perm = 0;
1448 ((perm & GLUSTER_ACL_READ) ? SMB_ACL_READ : 0);
1450 ((perm & GLUSTER_ACL_WRITE) ? SMB_ACL_WRITE : 0);
1452 ((perm & GLUSTER_ACL_EXECUTE) ? SMB_ACL_EXECUTE : 0);
1461 static int gluster_ace_cmp(const void *left, const void *right)
1464 uint16_t tag_left, tag_right;
1465 uint32_t id_left, id_right;
1470 - Smaller TAG values must be earlier.
1472 - Within same TAG, smaller identifiers must be earlier, E.g:
1473 UID 0 entry must be earlier than UID 200
1474 GID 17 entry must be earlier than GID 19
1477 /* TAG is the first element in the entry */
1478 tag_left = SVAL(left, 0);
1479 tag_right = SVAL(right, 0);
1481 ret = (tag_left - tag_right);
1483 /* ID is the third element in the entry, after two short
1484 integers (tag and perm), i.e at offset 4.
1486 id_left = IVAL(left, 4);
1487 id_right = IVAL(right, 4);
1488 ret = id_left - id_right;
1495 static ssize_t smb_to_gluster_acl(SMB_ACL_T theacl, char *buf, size_t len)
1498 struct smb_acl_entry *smb_ace;
1506 count = theacl->count;
1508 size = GLUSTER_ACL_HEADER_SIZE + (count * GLUSTER_ACL_ENTRY_SIZE);
1518 smb_ace = theacl->acl;
1520 /* Version is the first 4 bytes of the ACL */
1521 SIVAL(buf, 0, GLUSTER_ACL_VERSION);
1522 offset = GLUSTER_ACL_HEADER_SIZE;
1524 for (i = 0; i < count; i++) {
1526 switch(smb_ace->a_type) {
1528 tag = GLUSTER_ACL_USER;
1530 case SMB_ACL_USER_OBJ:
1531 tag = GLUSTER_ACL_USER_OBJ;
1534 tag = GLUSTER_ACL_GROUP;
1536 case SMB_ACL_GROUP_OBJ:
1537 tag = GLUSTER_ACL_GROUP_OBJ;
1540 tag = GLUSTER_ACL_OTHER;
1543 tag = GLUSTER_ACL_MASK;
1546 DEBUG(0, ("Unknown tag value %d\n",
1554 switch(smb_ace->a_type) {
1556 id = smb_ace->info.user.uid;
1559 id = smb_ace->info.group.gid;
1562 id = GLUSTER_ACL_UNDEFINED_ID;
1566 /* Calculate perm */
1570 ((smb_ace->a_perm & SMB_ACL_READ) ? GLUSTER_ACL_READ : 0);
1572 ((smb_ace->a_perm & SMB_ACL_WRITE) ? GLUSTER_ACL_WRITE : 0);
1574 ((smb_ace->a_perm & SMB_ACL_EXECUTE) ? GLUSTER_ACL_EXECUTE : 0);
1577 /* TAG is the first 2 bytes of an entry */
1578 SSVAL(buf, offset, tag);
1581 /* PERM is the next 2 bytes of an entry */
1582 SSVAL(buf, offset, perm);
1585 /* ID is the last 4 bytes of an entry */
1586 SIVAL(buf, offset, id);
1592 /* Skip the header, sort @count number of 8-byte entries */
1593 qsort(buf+GLUSTER_ACL_HEADER_SIZE, count, GLUSTER_ACL_ENTRY_SIZE,
1600 static SMB_ACL_T vfs_gluster_sys_acl_get_file(struct vfs_handle_struct *handle,
1602 SMB_ACL_TYPE_T type,
1603 TALLOC_CTX *mem_ctx)
1605 struct smb_acl_t *result;
1609 ssize_t ret, size = GLUSTER_ACL_SIZE(20);
1612 case SMB_ACL_TYPE_ACCESS:
1613 key = "system.posix_acl_access";
1615 case SMB_ACL_TYPE_DEFAULT:
1616 key = "system.posix_acl_default";
1628 ret = glfs_getxattr(handle->data, path_p, key, buf, size);
1629 if (ret == -1 && errno == ERANGE) {
1630 ret = glfs_getxattr(handle->data, path_p, key, 0, 0);
1636 ret = glfs_getxattr(handle->data, path_p, key, buf, ret);
1640 /* retrieving the ACL from the xattr has finally failed, do a
1641 * mode-to-acl mapping */
1643 if (ret == -1 && errno == ENODATA) {
1644 ret = glfs_stat(handle->data, path_p, &st);
1646 result = mode_to_smb_acls(&st, mem_ctx);
1655 result = gluster_to_smb_acl(buf, ret, mem_ctx);
1660 static SMB_ACL_T vfs_gluster_sys_acl_get_fd(struct vfs_handle_struct *handle,
1661 struct files_struct *fsp,
1662 TALLOC_CTX *mem_ctx)
1664 struct smb_acl_t *result;
1666 ssize_t ret, size = GLUSTER_ACL_SIZE(20);
1670 glfd = *(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp);
1677 ret = glfs_fgetxattr(glfd, "system.posix_acl_access", buf, size);
1678 if (ret == -1 && errno == ERANGE) {
1679 ret = glfs_fgetxattr(glfd, "system.posix_acl_access", 0, 0);
1685 ret = glfs_fgetxattr(glfd, "system.posix_acl_access",
1690 /* retrieving the ACL from the xattr has finally failed, do a
1691 * mode-to-acl mapping */
1693 if (ret == -1 && errno == ENODATA) {
1694 ret = glfs_fstat(glfd, &st);
1696 result = mode_to_smb_acls(&st, mem_ctx);
1705 result = gluster_to_smb_acl(buf, ret, mem_ctx);
1710 static int vfs_gluster_sys_acl_set_file(struct vfs_handle_struct *handle,
1712 SMB_ACL_TYPE_T acltype,
1721 case SMB_ACL_TYPE_ACCESS:
1722 key = "system.posix_acl_access";
1724 case SMB_ACL_TYPE_DEFAULT:
1725 key = "system.posix_acl_default";
1732 size = smb_to_gluster_acl(theacl, 0, 0);
1735 size = smb_to_gluster_acl(theacl, buf, size);
1740 ret = glfs_setxattr(handle->data, name, key, buf, size, 0);
1745 static int vfs_gluster_sys_acl_set_fd(struct vfs_handle_struct *handle,
1746 struct files_struct *fsp,
1753 size = smb_to_gluster_acl(theacl, 0, 0);
1756 size = smb_to_gluster_acl(theacl, buf, size);
1761 ret = glfs_fsetxattr(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp),
1762 "system.posix_acl_access", buf, size, 0);
1766 static int vfs_gluster_sys_acl_delete_def_file(struct vfs_handle_struct *handle,
1769 return glfs_removexattr(handle->data, path, "system.posix_acl_default");
1772 static struct vfs_fn_pointers glusterfs_fns = {
1774 /* Disk Operations */
1776 .connect_fn = vfs_gluster_connect,
1777 .disconnect_fn = vfs_gluster_disconnect,
1778 .disk_free_fn = vfs_gluster_disk_free,
1779 .get_quota_fn = vfs_gluster_get_quota,
1780 .set_quota_fn = vfs_gluster_set_quota,
1781 .statvfs_fn = vfs_gluster_statvfs,
1782 .fs_capabilities_fn = vfs_gluster_fs_capabilities,
1784 .get_dfs_referrals_fn = NULL,
1786 /* Directory Operations */
1788 .opendir_fn = vfs_gluster_opendir,
1789 .fdopendir_fn = vfs_gluster_fdopendir,
1790 .readdir_fn = vfs_gluster_readdir,
1791 .seekdir_fn = vfs_gluster_seekdir,
1792 .telldir_fn = vfs_gluster_telldir,
1793 .rewind_dir_fn = vfs_gluster_rewinddir,
1794 .mkdir_fn = vfs_gluster_mkdir,
1795 .rmdir_fn = vfs_gluster_rmdir,
1796 .closedir_fn = vfs_gluster_closedir,
1797 .init_search_op_fn = vfs_gluster_init_search_op,
1799 /* File Operations */
1801 .open_fn = vfs_gluster_open,
1802 .create_file_fn = NULL,
1803 .close_fn = vfs_gluster_close,
1804 .read_fn = vfs_gluster_read,
1805 .pread_fn = vfs_gluster_pread,
1806 .pread_send_fn = vfs_gluster_pread_send,
1807 .pread_recv_fn = vfs_gluster_recv,
1808 .write_fn = vfs_gluster_write,
1809 .pwrite_fn = vfs_gluster_pwrite,
1810 .pwrite_send_fn = vfs_gluster_pwrite_send,
1811 .pwrite_recv_fn = vfs_gluster_recv,
1812 .lseek_fn = vfs_gluster_lseek,
1813 .sendfile_fn = vfs_gluster_sendfile,
1814 .recvfile_fn = vfs_gluster_recvfile,
1815 .rename_fn = vfs_gluster_rename,
1816 .fsync_fn = vfs_gluster_fsync,
1817 .fsync_send_fn = vfs_gluster_fsync_send,
1818 .fsync_recv_fn = vfs_gluster_fsync_recv,
1820 .stat_fn = vfs_gluster_stat,
1821 .fstat_fn = vfs_gluster_fstat,
1822 .lstat_fn = vfs_gluster_lstat,
1823 .get_alloc_size_fn = vfs_gluster_get_alloc_size,
1824 .unlink_fn = vfs_gluster_unlink,
1826 .chmod_fn = vfs_gluster_chmod,
1827 .fchmod_fn = vfs_gluster_fchmod,
1828 .chown_fn = vfs_gluster_chown,
1829 .fchown_fn = vfs_gluster_fchown,
1830 .lchown_fn = vfs_gluster_lchown,
1831 .chdir_fn = vfs_gluster_chdir,
1832 .getwd_fn = vfs_gluster_getwd,
1833 .ntimes_fn = vfs_gluster_ntimes,
1834 .ftruncate_fn = vfs_gluster_ftruncate,
1835 .fallocate_fn = vfs_gluster_fallocate,
1836 .lock_fn = vfs_gluster_lock,
1837 .kernel_flock_fn = vfs_gluster_kernel_flock,
1838 .linux_setlease_fn = vfs_gluster_linux_setlease,
1839 .getlock_fn = vfs_gluster_getlock,
1840 .symlink_fn = vfs_gluster_symlink,
1841 .readlink_fn = vfs_gluster_readlink,
1842 .link_fn = vfs_gluster_link,
1843 .mknod_fn = vfs_gluster_mknod,
1844 .realpath_fn = vfs_gluster_realpath,
1845 .chflags_fn = vfs_gluster_chflags,
1846 .file_id_create_fn = NULL,
1847 .copy_chunk_send_fn = NULL,
1848 .copy_chunk_recv_fn = NULL,
1849 .streaminfo_fn = NULL,
1850 .get_real_filename_fn = vfs_gluster_get_real_filename,
1851 .connectpath_fn = vfs_gluster_connectpath,
1853 .brl_lock_windows_fn = NULL,
1854 .brl_unlock_windows_fn = NULL,
1855 .brl_cancel_windows_fn = NULL,
1856 .strict_lock_fn = NULL,
1857 .strict_unlock_fn = NULL,
1858 .translate_name_fn = NULL,
1861 /* NT ACL Operations */
1862 .fget_nt_acl_fn = NULL,
1863 .get_nt_acl_fn = NULL,
1864 .fset_nt_acl_fn = NULL,
1865 .audit_file_fn = NULL,
1867 /* Posix ACL Operations */
1868 .chmod_acl_fn = NULL, /* passthrough to default */
1869 .fchmod_acl_fn = NULL, /* passthrough to default */
1870 .sys_acl_get_file_fn = vfs_gluster_sys_acl_get_file,
1871 .sys_acl_get_fd_fn = vfs_gluster_sys_acl_get_fd,
1872 .sys_acl_blob_get_file_fn = posix_sys_acl_blob_get_file,
1873 .sys_acl_blob_get_fd_fn = posix_sys_acl_blob_get_fd,
1874 .sys_acl_set_file_fn = vfs_gluster_sys_acl_set_file,
1875 .sys_acl_set_fd_fn = vfs_gluster_sys_acl_set_fd,
1876 .sys_acl_delete_def_file_fn = vfs_gluster_sys_acl_delete_def_file,
1879 .getxattr_fn = vfs_gluster_getxattr,
1880 .fgetxattr_fn = vfs_gluster_fgetxattr,
1881 .listxattr_fn = vfs_gluster_listxattr,
1882 .flistxattr_fn = vfs_gluster_flistxattr,
1883 .removexattr_fn = vfs_gluster_removexattr,
1884 .fremovexattr_fn = vfs_gluster_fremovexattr,
1885 .setxattr_fn = vfs_gluster_setxattr,
1886 .fsetxattr_fn = vfs_gluster_fsetxattr,
1888 /* AIO Operations */
1889 .aio_force_fn = vfs_gluster_aio_force,
1891 /* Offline Operations */
1892 .is_offline_fn = vfs_gluster_is_offline,
1893 .set_offline_fn = vfs_gluster_set_offline,
1895 /* Durable handle Operations */
1896 .durable_cookie_fn = NULL,
1897 .durable_disconnect_fn = NULL,
1898 .durable_reconnect_fn = NULL,
1901 NTSTATUS vfs_glusterfs_init(void);
1902 NTSTATUS vfs_glusterfs_init(void)
1904 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
1905 "glusterfs", &glusterfs_fns);