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 char *path, const char *mask,
363 fd = glfs_opendir(handle->data, path);
365 DEBUG(0, ("glfs_opendir(%s) failed: %s\n",
366 path, strerror(errno)));
372 static DIR *vfs_gluster_fdopendir(struct vfs_handle_struct *handle,
373 files_struct *fsp, const char *mask,
376 return (DIR *) *(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp);
379 static int vfs_gluster_closedir(struct vfs_handle_struct *handle, DIR *dirp)
381 return glfs_closedir((void *)dirp);
384 static struct dirent *vfs_gluster_readdir(struct vfs_handle_struct *handle,
385 DIR *dirp, SMB_STRUCT_STAT *sbuf)
387 static char direntbuf[512];
390 struct dirent *dirent = 0;
393 ret = glfs_readdirplus_r((void *)dirp, &stat, (void *)direntbuf,
396 ret = glfs_readdir_r((void *)dirp, (void *)direntbuf, &dirent);
399 if ((ret < 0) || (dirent == NULL)) {
404 smb_stat_ex_from_stat(sbuf, &stat);
410 static long vfs_gluster_telldir(struct vfs_handle_struct *handle, DIR *dirp)
412 return glfs_telldir((void *)dirp);
415 static void vfs_gluster_seekdir(struct vfs_handle_struct *handle, DIR *dirp,
418 glfs_seekdir((void *)dirp, offset);
421 static void vfs_gluster_rewinddir(struct vfs_handle_struct *handle, DIR *dirp)
423 glfs_seekdir((void *)dirp, 0);
426 static void vfs_gluster_init_search_op(struct vfs_handle_struct *handle,
432 static int vfs_gluster_mkdir(struct vfs_handle_struct *handle, const char *path,
435 return glfs_mkdir(handle->data, path, mode);
438 static int vfs_gluster_rmdir(struct vfs_handle_struct *handle, const char *path)
440 return glfs_rmdir(handle->data, path);
443 static int vfs_gluster_open(struct vfs_handle_struct *handle,
444 struct smb_filename *smb_fname, files_struct *fsp,
445 int flags, mode_t mode)
450 if (flags & O_DIRECTORY) {
451 glfd = glfs_opendir(handle->data, smb_fname->base_name);
452 } else if (flags & O_CREAT) {
453 glfd = glfs_creat(handle->data, smb_fname->base_name, flags,
456 glfd = glfs_open(handle->data, smb_fname->base_name, flags);
462 p_tmp = (glfs_fd_t **)VFS_ADD_FSP_EXTENSION(handle, fsp,
465 /* An arbitrary value for error reporting, so you know its us. */
469 static int vfs_gluster_close(struct vfs_handle_struct *handle,
473 glfd = *(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp);
474 VFS_REMOVE_FSP_EXTENSION(handle, fsp);
475 return glfs_close(glfd);
478 static ssize_t vfs_gluster_read(struct vfs_handle_struct *handle,
479 files_struct *fsp, void *data, size_t n)
481 return glfs_read(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), data, n, 0);
484 static ssize_t vfs_gluster_pread(struct vfs_handle_struct *handle,
485 files_struct *fsp, void *data, size_t n,
488 return glfs_pread(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), data, n, offset, 0);
491 struct glusterfs_aio_state;
493 struct glusterfs_aio_wrapper {
494 struct glusterfs_aio_state *state;
497 struct glusterfs_aio_state {
500 struct tevent_req *req;
504 static int aio_wrapper_destructor(struct glusterfs_aio_wrapper *wrap)
506 wrap->state->cancelled = true;
512 * This function is the callback that will be called on glusterfs
513 * threads once the async IO submitted is complete. To notify
514 * Samba of the completion we use a pipe based queue.
516 static void aio_glusterfs_done(glfs_fd_t *fd, ssize_t ret, void *data)
518 struct glusterfs_aio_state *state = NULL;
521 state = (struct glusterfs_aio_state *)data;
532 * Write the state pointer to glusterfs_aio_state to the
533 * pipe, so we can call tevent_req_done() from the main thread,
534 * because tevent_req_done() is not designed to be executed in
535 * the multithread environment, so tevent_req_done() must be
536 * executed from the smbd main thread.
538 * write(2) on pipes with sizes under _POSIX_PIPE_BUF
539 * in size is atomic, without this, the use op pipes in this
540 * code would not work.
542 * sys_write is a thin enough wrapper around write(2)
543 * that we can trust it here.
546 sts = sys_write(write_fd, &state, sizeof(struct glusterfs_aio_state *));
548 DEBUG(0,("\nWrite to pipe failed (%s)", strerror(errno)));
555 * Read each req off the pipe and process it.
557 static void aio_tevent_fd_done(struct tevent_context *event_ctx,
558 struct tevent_fd *fde,
559 uint16_t flags, void *data)
561 struct tevent_req *req = NULL;
562 struct glusterfs_aio_state *state = NULL;
566 * read(2) on pipes is atomic if the needed data is available
567 * in the pipe, per SUS and POSIX. Because we always write
568 * to the pipe in sizeof(struct tevent_req *) chunks, we can
569 * always read in those chunks, atomically.
571 * sys_read is a thin enough wrapper around read(2) that we
575 sts = sys_read(read_fd, &state, sizeof(struct glusterfs_aio_state *));
578 DEBUG(0,("\nRead from pipe failed (%s)", strerror(errno)));
581 /* if we've cancelled the op, there is no req, so just clean up. */
582 if (state->cancelled == true) {
590 tevent_req_done(req);
595 static bool init_gluster_aio(struct vfs_handle_struct *handle)
602 * Already initialized.
615 aio_read_event = tevent_add_fd(handle->conn->sconn->ev_ctx,
621 if (aio_read_event == NULL) {
627 TALLOC_FREE(aio_read_event);
637 static struct glusterfs_aio_state *aio_state_create(TALLOC_CTX *mem_ctx)
639 struct tevent_req *req = NULL;
640 struct glusterfs_aio_state *state = NULL;
641 struct glusterfs_aio_wrapper *wrapper = NULL;
643 req = tevent_req_create(mem_ctx, &wrapper, struct glusterfs_aio_wrapper);
649 state = talloc(NULL, struct glusterfs_aio_state);
656 talloc_set_destructor(wrapper, aio_wrapper_destructor);
657 state->cancelled = false;
662 wrapper->state = state;
667 static struct tevent_req *vfs_gluster_pread_send(struct vfs_handle_struct
668 *handle, TALLOC_CTX *mem_ctx,
669 struct tevent_context *ev,
671 void *data, size_t n,
674 struct glusterfs_aio_state *state = NULL;
675 struct tevent_req *req = NULL;
678 state = aio_state_create(mem_ctx);
686 if (!init_gluster_aio(handle)) {
687 tevent_req_error(req, EIO);
688 return tevent_req_post(req, ev);
691 ret = glfs_pread_async(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle,
692 fsp), data, n, offset, 0, aio_glusterfs_done,
695 tevent_req_error(req, -ret);
696 return tevent_req_post(req, ev);
702 static struct tevent_req *vfs_gluster_pwrite_send(struct vfs_handle_struct
703 *handle, TALLOC_CTX *mem_ctx,
704 struct tevent_context *ev,
706 const void *data, size_t n,
709 struct glusterfs_aio_state *state = NULL;
710 struct tevent_req *req = NULL;
713 state = aio_state_create(mem_ctx);
721 if (!init_gluster_aio(handle)) {
722 tevent_req_error(req, EIO);
723 return tevent_req_post(req, ev);
726 ret = glfs_pwrite_async(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle,
727 fsp), data, n, offset, 0, aio_glusterfs_done,
730 tevent_req_error(req, -ret);
731 return tevent_req_post(req, ev);
737 static ssize_t vfs_gluster_recv(struct tevent_req *req, int *err)
739 struct glusterfs_aio_state *state = NULL;
740 struct glusterfs_aio_wrapper *wrapper = NULL;
743 wrapper = tevent_req_data(req, struct glusterfs_aio_wrapper);
745 if (wrapper == NULL) {
749 state = wrapper->state;
755 if (tevent_req_is_unix_error(req, err)) {
758 if (state->ret == -1) {
764 /* Clean up the state, it is in a NULL context. */
771 static ssize_t vfs_gluster_write(struct vfs_handle_struct *handle,
772 files_struct *fsp, const void *data, size_t n)
774 return glfs_write(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), data, n, 0);
777 static ssize_t vfs_gluster_pwrite(struct vfs_handle_struct *handle,
778 files_struct *fsp, const void *data,
779 size_t n, off_t offset)
781 return glfs_pwrite(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), data, n, offset, 0);
784 static off_t vfs_gluster_lseek(struct vfs_handle_struct *handle,
785 files_struct *fsp, off_t offset, int whence)
787 return glfs_lseek(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), offset, whence);
790 static ssize_t vfs_gluster_sendfile(struct vfs_handle_struct *handle, int tofd,
791 files_struct *fromfsp,
792 const DATA_BLOB *hdr,
793 off_t offset, size_t n)
799 static ssize_t vfs_gluster_recvfile(struct vfs_handle_struct *handle,
800 int fromfd, files_struct *tofsp,
801 off_t offset, size_t n)
807 static int vfs_gluster_rename(struct vfs_handle_struct *handle,
808 const struct smb_filename *smb_fname_src,
809 const struct smb_filename *smb_fname_dst)
811 return glfs_rename(handle->data, smb_fname_src->base_name,
812 smb_fname_dst->base_name);
815 static int vfs_gluster_fsync(struct vfs_handle_struct *handle,
818 return glfs_fsync(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp));
821 static struct tevent_req *vfs_gluster_fsync_send(struct vfs_handle_struct
822 *handle, TALLOC_CTX *mem_ctx,
823 struct tevent_context *ev,
826 struct tevent_req *req = NULL;
827 struct glusterfs_aio_state *state = NULL;
830 state = aio_state_create(mem_ctx);
838 if (!init_gluster_aio(handle)) {
839 tevent_req_error(req, EIO);
840 return tevent_req_post(req, ev);
842 ret = glfs_fsync_async(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle,
843 fsp), aio_glusterfs_done, req);
845 tevent_req_error(req, -ret);
846 return tevent_req_post(req, ev);
851 static int vfs_gluster_fsync_recv(struct tevent_req *req, int *err)
854 * Use implicit conversion ssize_t->int
856 return vfs_gluster_recv(req, err);
859 static int vfs_gluster_stat(struct vfs_handle_struct *handle,
860 struct smb_filename *smb_fname)
865 ret = glfs_stat(handle->data, smb_fname->base_name, &st);
867 smb_stat_ex_from_stat(&smb_fname->st, &st);
869 if (ret < 0 && errno != ENOENT) {
870 DEBUG(0, ("glfs_stat(%s) failed: %s\n",
871 smb_fname->base_name, strerror(errno)));
876 static int vfs_gluster_fstat(struct vfs_handle_struct *handle,
877 files_struct *fsp, SMB_STRUCT_STAT *sbuf)
882 ret = glfs_fstat(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), &st);
884 smb_stat_ex_from_stat(sbuf, &st);
887 DEBUG(0, ("glfs_fstat(%d) failed: %s\n",
888 fsp->fh->fd, strerror(errno)));
893 static int vfs_gluster_lstat(struct vfs_handle_struct *handle,
894 struct smb_filename *smb_fname)
899 ret = glfs_lstat(handle->data, smb_fname->base_name, &st);
901 smb_stat_ex_from_stat(&smb_fname->st, &st);
903 if (ret < 0 && errno != ENOENT) {
904 DEBUG(0, ("glfs_lstat(%s) failed: %s\n",
905 smb_fname->base_name, strerror(errno)));
910 static uint64_t vfs_gluster_get_alloc_size(struct vfs_handle_struct *handle,
912 const SMB_STRUCT_STAT *sbuf)
914 return sbuf->st_ex_blocks * 512;
917 static int vfs_gluster_unlink(struct vfs_handle_struct *handle,
918 const struct smb_filename *smb_fname)
920 return glfs_unlink(handle->data, smb_fname->base_name);
923 static int vfs_gluster_chmod(struct vfs_handle_struct *handle,
924 const char *path, mode_t mode)
926 return glfs_chmod(handle->data, path, mode);
929 static int vfs_gluster_fchmod(struct vfs_handle_struct *handle,
930 files_struct *fsp, mode_t mode)
932 return glfs_fchmod(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), mode);
935 static int vfs_gluster_chown(struct vfs_handle_struct *handle,
936 const char *path, uid_t uid, gid_t gid)
938 return glfs_chown(handle->data, path, uid, gid);
941 static int vfs_gluster_fchown(struct vfs_handle_struct *handle,
942 files_struct *fsp, uid_t uid, gid_t gid)
944 return glfs_fchown(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), uid, gid);
947 static int vfs_gluster_lchown(struct vfs_handle_struct *handle,
948 const char *path, uid_t uid, gid_t gid)
950 return glfs_lchown(handle->data, path, uid, gid);
953 static int vfs_gluster_chdir(struct vfs_handle_struct *handle, const char *path)
955 return glfs_chdir(handle->data, path);
958 static char *vfs_gluster_getwd(struct vfs_handle_struct *handle)
963 cwd = SMB_CALLOC_ARRAY(char, PATH_MAX);
968 ret = glfs_getcwd(handle->data, cwd, PATH_MAX - 1);
975 static int vfs_gluster_ntimes(struct vfs_handle_struct *handle,
976 const struct smb_filename *smb_fname,
977 struct smb_file_time *ft)
979 struct timespec times[2];
981 if (null_timespec(ft->atime)) {
982 times[0].tv_sec = smb_fname->st.st_ex_atime.tv_sec;
983 times[0].tv_nsec = smb_fname->st.st_ex_atime.tv_nsec;
985 times[0].tv_sec = ft->atime.tv_sec;
986 times[0].tv_nsec = ft->atime.tv_nsec;
989 if (null_timespec(ft->mtime)) {
990 times[1].tv_sec = smb_fname->st.st_ex_mtime.tv_sec;
991 times[1].tv_nsec = smb_fname->st.st_ex_mtime.tv_nsec;
993 times[1].tv_sec = ft->mtime.tv_sec;
994 times[1].tv_nsec = ft->mtime.tv_nsec;
997 if ((timespec_compare(×[0],
998 &smb_fname->st.st_ex_atime) == 0) &&
999 (timespec_compare(×[1],
1000 &smb_fname->st.st_ex_mtime) == 0)) {
1004 return glfs_utimens(handle->data, smb_fname->base_name, times);
1007 static int vfs_gluster_ftruncate(struct vfs_handle_struct *handle,
1008 files_struct *fsp, off_t offset)
1010 return glfs_ftruncate(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), offset);
1013 static int vfs_gluster_fallocate(struct vfs_handle_struct *handle,
1014 struct files_struct *fsp,
1016 off_t offset, off_t len)
1018 /* TODO: add support using glfs_fallocate() and glfs_zerofill() */
1023 static char *vfs_gluster_realpath(struct vfs_handle_struct *handle,
1026 return glfs_realpath(handle->data, path, 0);
1029 static bool vfs_gluster_lock(struct vfs_handle_struct *handle,
1030 files_struct *fsp, int op, off_t offset,
1031 off_t count, int type)
1033 struct flock flock = { 0, };
1036 flock.l_type = type;
1037 flock.l_whence = SEEK_SET;
1038 flock.l_start = offset;
1039 flock.l_len = count;
1042 ret = glfs_posix_lock(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), op, &flock);
1044 if (op == F_GETLK) {
1045 /* lock query, true if someone else has locked */
1047 (flock.l_type != F_UNLCK) &&
1048 (flock.l_pid != 0) && (flock.l_pid != getpid()))
1061 static int vfs_gluster_kernel_flock(struct vfs_handle_struct *handle,
1062 files_struct *fsp, uint32_t share_mode,
1063 uint32_t access_mask)
1069 static int vfs_gluster_linux_setlease(struct vfs_handle_struct *handle,
1070 files_struct *fsp, int leasetype)
1076 static bool vfs_gluster_getlock(struct vfs_handle_struct *handle,
1077 files_struct *fsp, off_t *poffset,
1078 off_t *pcount, int *ptype, pid_t *ppid)
1080 struct flock flock = { 0, };
1083 flock.l_type = *ptype;
1084 flock.l_whence = SEEK_SET;
1085 flock.l_start = *poffset;
1086 flock.l_len = *pcount;
1089 ret = glfs_posix_lock(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), F_GETLK, &flock);
1095 *ptype = flock.l_type;
1096 *poffset = flock.l_start;
1097 *pcount = flock.l_len;
1098 *ppid = flock.l_pid;
1103 static int vfs_gluster_symlink(struct vfs_handle_struct *handle,
1104 const char *oldpath, const char *newpath)
1106 return glfs_symlink(handle->data, oldpath, newpath);
1109 static int vfs_gluster_readlink(struct vfs_handle_struct *handle,
1110 const char *path, char *buf, size_t bufsiz)
1112 return glfs_readlink(handle->data, path, buf, bufsiz);
1115 static int vfs_gluster_link(struct vfs_handle_struct *handle,
1116 const char *oldpath, const char *newpath)
1118 return glfs_link(handle->data, oldpath, newpath);
1121 static int vfs_gluster_mknod(struct vfs_handle_struct *handle, const char *path,
1122 mode_t mode, SMB_DEV_T dev)
1124 return glfs_mknod(handle->data, path, mode, dev);
1127 static int vfs_gluster_chflags(struct vfs_handle_struct *handle,
1128 const char *path, unsigned int flags)
1134 static int vfs_gluster_get_real_filename(struct vfs_handle_struct *handle,
1135 const char *path, const char *name,
1136 TALLOC_CTX *mem_ctx, char **found_name)
1139 char key_buf[NAME_MAX + 64];
1140 char val_buf[NAME_MAX + 1];
1142 if (strlen(name) >= NAME_MAX) {
1143 errno = ENAMETOOLONG;
1147 snprintf(key_buf, NAME_MAX + 64,
1148 "glusterfs.get_real_filename:%s", name);
1150 ret = glfs_getxattr(handle->data, path, key_buf, val_buf, NAME_MAX + 1);
1152 if (errno == ENODATA) {
1158 *found_name = talloc_strdup(mem_ctx, val_buf);
1159 if (found_name[0] == NULL) {
1166 static const char *vfs_gluster_connectpath(struct vfs_handle_struct *handle,
1167 const char *filename)
1169 return handle->conn->connectpath;
1174 static ssize_t vfs_gluster_getxattr(struct vfs_handle_struct *handle,
1175 const char *path, const char *name,
1176 void *value, size_t size)
1178 return glfs_getxattr(handle->data, path, name, value, size);
1181 static ssize_t vfs_gluster_fgetxattr(struct vfs_handle_struct *handle,
1182 files_struct *fsp, const char *name,
1183 void *value, size_t size)
1185 return glfs_fgetxattr(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), name, value, size);
1188 static ssize_t vfs_gluster_listxattr(struct vfs_handle_struct *handle,
1189 const char *path, char *list, size_t size)
1191 return glfs_listxattr(handle->data, path, list, size);
1194 static ssize_t vfs_gluster_flistxattr(struct vfs_handle_struct *handle,
1195 files_struct *fsp, char *list,
1198 return glfs_flistxattr(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), list, size);
1201 static int vfs_gluster_removexattr(struct vfs_handle_struct *handle,
1202 const char *path, const char *name)
1204 return glfs_removexattr(handle->data, path, name);
1207 static int vfs_gluster_fremovexattr(struct vfs_handle_struct *handle,
1208 files_struct *fsp, const char *name)
1210 return glfs_fremovexattr(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), name);
1213 static int vfs_gluster_setxattr(struct vfs_handle_struct *handle,
1214 const char *path, const char *name,
1215 const void *value, size_t size, int flags)
1217 return glfs_setxattr(handle->data, path, name, value, size, flags);
1220 static int vfs_gluster_fsetxattr(struct vfs_handle_struct *handle,
1221 files_struct *fsp, const char *name,
1222 const void *value, size_t size, int flags)
1224 return glfs_fsetxattr(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp), name, value, size,
1228 /* AIO Operations */
1230 static bool vfs_gluster_aio_force(struct vfs_handle_struct *handle,
1236 /* Offline Operations */
1238 static bool vfs_gluster_is_offline(struct vfs_handle_struct *handle,
1239 const struct smb_filename *fname,
1240 SMB_STRUCT_STAT *sbuf)
1245 static int vfs_gluster_set_offline(struct vfs_handle_struct *handle,
1246 const struct smb_filename *fname)
1255 Size = 4 (header) + N * 8 (entry)
1257 Offset Size Field (Little Endian)
1258 -------------------------------------
1261 4-5 2-byte Entry-1 tag
1262 6-7 2-byte Entry-1 perm
1263 8-11 4-byte Entry-1 id
1265 12-13 2-byte Entry-2 tag
1266 14-15 2-byte Entry-2 perm
1267 16-19 4-byte Entry-2 id
1273 /* header version */
1274 #define GLUSTER_ACL_VERSION 2
1277 #define GLUSTER_ACL_READ 0x04
1278 #define GLUSTER_ACL_WRITE 0x02
1279 #define GLUSTER_ACL_EXECUTE 0x01
1282 #define GLUSTER_ACL_UNDEFINED_TAG 0x00
1283 #define GLUSTER_ACL_USER_OBJ 0x01
1284 #define GLUSTER_ACL_USER 0x02
1285 #define GLUSTER_ACL_GROUP_OBJ 0x04
1286 #define GLUSTER_ACL_GROUP 0x08
1287 #define GLUSTER_ACL_MASK 0x10
1288 #define GLUSTER_ACL_OTHER 0x20
1290 #define GLUSTER_ACL_UNDEFINED_ID (-1)
1292 #define GLUSTER_ACL_HEADER_SIZE 4
1293 #define GLUSTER_ACL_ENTRY_SIZE 8
1295 #define GLUSTER_ACL_SIZE(n) (GLUSTER_ACL_HEADER_SIZE + (n * GLUSTER_ACL_ENTRY_SIZE))
1297 static SMB_ACL_T mode_to_smb_acls(const struct stat *mode, TALLOC_CTX *mem_ctx)
1299 struct smb_acl_t *result;
1303 result = sys_acl_init(mem_ctx);
1309 result->acl = talloc_array(result, struct smb_acl_entry, count);
1312 talloc_free(result);
1316 result->count = count;
1318 result->acl[0].a_type = SMB_ACL_USER_OBJ;
1319 result->acl[0].a_perm = (mode->st_mode & S_IRWXU) >> 6;;
1321 result->acl[1].a_type = SMB_ACL_GROUP_OBJ;
1322 result->acl[1].a_perm = (mode->st_mode & S_IRWXG) >> 3;;
1324 result->acl[2].a_type = SMB_ACL_OTHER;
1325 result->acl[2].a_perm = mode->st_mode & S_IRWXO;;
1330 static SMB_ACL_T gluster_to_smb_acl(const char *buf, size_t xattr_size,
1331 TALLOC_CTX *mem_ctx)
1335 struct smb_acl_entry *smb_ace;
1336 struct smb_acl_t *result;
1345 if (size < GLUSTER_ACL_HEADER_SIZE) {
1346 /* ACL should be at least as big as the header (4 bytes) */
1351 size -= GLUSTER_ACL_HEADER_SIZE; /* size of header = 4 bytes */
1353 if (size % GLUSTER_ACL_ENTRY_SIZE) {
1354 /* Size of entries must strictly be a multiple of
1355 size of an ACE (8 bytes)
1361 count = size / GLUSTER_ACL_ENTRY_SIZE;
1363 /* Version is the first 4 bytes of the ACL */
1364 if (IVAL(buf, 0) != GLUSTER_ACL_VERSION) {
1365 DEBUG(0, ("Unknown gluster ACL version: %d\n",
1369 offset = GLUSTER_ACL_HEADER_SIZE;
1371 result = sys_acl_init(mem_ctx);
1377 result->acl = talloc_array(result, struct smb_acl_entry, count);
1380 talloc_free(result);
1384 result->count = count;
1386 smb_ace = result->acl;
1388 for (i = 0; i < count; i++) {
1389 /* TAG is the first 2 bytes of an entry */
1390 tag = SVAL(buf, offset);
1393 /* PERM is the next 2 bytes of an entry */
1394 perm = SVAL(buf, offset);
1397 /* ID is the last 4 bytes of an entry */
1398 id = IVAL(buf, offset);
1402 case GLUSTER_ACL_USER:
1403 smb_ace->a_type = SMB_ACL_USER;
1405 case GLUSTER_ACL_USER_OBJ:
1406 smb_ace->a_type = SMB_ACL_USER_OBJ;
1408 case GLUSTER_ACL_GROUP:
1409 smb_ace->a_type = SMB_ACL_GROUP;
1411 case GLUSTER_ACL_GROUP_OBJ:
1412 smb_ace->a_type = SMB_ACL_GROUP_OBJ;
1414 case GLUSTER_ACL_OTHER:
1415 smb_ace->a_type = SMB_ACL_OTHER;
1417 case GLUSTER_ACL_MASK:
1418 smb_ace->a_type = SMB_ACL_MASK;
1421 DEBUG(0, ("unknown tag type %d\n", (unsigned int) tag));
1426 switch(smb_ace->a_type) {
1428 smb_ace->info.user.uid = id;
1431 smb_ace->info.group.gid = id;
1437 smb_ace->a_perm = 0;
1439 ((perm & GLUSTER_ACL_READ) ? SMB_ACL_READ : 0);
1441 ((perm & GLUSTER_ACL_WRITE) ? SMB_ACL_WRITE : 0);
1443 ((perm & GLUSTER_ACL_EXECUTE) ? SMB_ACL_EXECUTE : 0);
1452 static int gluster_ace_cmp(const void *left, const void *right)
1455 uint16_t tag_left, tag_right;
1456 uint32_t id_left, id_right;
1461 - Smaller TAG values must be earlier.
1463 - Within same TAG, smaller identifiers must be earlier, E.g:
1464 UID 0 entry must be earlier than UID 200
1465 GID 17 entry must be earlier than GID 19
1468 /* TAG is the first element in the entry */
1469 tag_left = SVAL(left, 0);
1470 tag_right = SVAL(right, 0);
1472 ret = (tag_left - tag_right);
1474 /* ID is the third element in the entry, after two short
1475 integers (tag and perm), i.e at offset 4.
1477 id_left = IVAL(left, 4);
1478 id_right = IVAL(right, 4);
1479 ret = id_left - id_right;
1486 static ssize_t smb_to_gluster_acl(SMB_ACL_T theacl, char *buf, size_t len)
1489 struct smb_acl_entry *smb_ace;
1497 count = theacl->count;
1499 size = GLUSTER_ACL_HEADER_SIZE + (count * GLUSTER_ACL_ENTRY_SIZE);
1509 smb_ace = theacl->acl;
1511 /* Version is the first 4 bytes of the ACL */
1512 SIVAL(buf, 0, GLUSTER_ACL_VERSION);
1513 offset = GLUSTER_ACL_HEADER_SIZE;
1515 for (i = 0; i < count; i++) {
1517 switch(smb_ace->a_type) {
1519 tag = GLUSTER_ACL_USER;
1521 case SMB_ACL_USER_OBJ:
1522 tag = GLUSTER_ACL_USER_OBJ;
1525 tag = GLUSTER_ACL_GROUP;
1527 case SMB_ACL_GROUP_OBJ:
1528 tag = GLUSTER_ACL_GROUP_OBJ;
1531 tag = GLUSTER_ACL_OTHER;
1534 tag = GLUSTER_ACL_MASK;
1537 DEBUG(0, ("Unknown tag value %d\n",
1545 switch(smb_ace->a_type) {
1547 id = smb_ace->info.user.uid;
1550 id = smb_ace->info.group.gid;
1553 id = GLUSTER_ACL_UNDEFINED_ID;
1557 /* Calculate perm */
1561 ((smb_ace->a_perm & SMB_ACL_READ) ? GLUSTER_ACL_READ : 0);
1563 ((smb_ace->a_perm & SMB_ACL_WRITE) ? GLUSTER_ACL_WRITE : 0);
1565 ((smb_ace->a_perm & SMB_ACL_EXECUTE) ? GLUSTER_ACL_EXECUTE : 0);
1568 /* TAG is the first 2 bytes of an entry */
1569 SSVAL(buf, offset, tag);
1572 /* PERM is the next 2 bytes of an entry */
1573 SSVAL(buf, offset, perm);
1576 /* ID is the last 4 bytes of an entry */
1577 SIVAL(buf, offset, id);
1583 /* Skip the header, sort @count number of 8-byte entries */
1584 qsort(buf+GLUSTER_ACL_HEADER_SIZE, count, GLUSTER_ACL_ENTRY_SIZE,
1591 static SMB_ACL_T vfs_gluster_sys_acl_get_file(struct vfs_handle_struct *handle,
1593 SMB_ACL_TYPE_T type,
1594 TALLOC_CTX *mem_ctx)
1596 struct smb_acl_t *result;
1600 ssize_t ret, size = GLUSTER_ACL_SIZE(20);
1603 case SMB_ACL_TYPE_ACCESS:
1604 key = "system.posix_acl_access";
1606 case SMB_ACL_TYPE_DEFAULT:
1607 key = "system.posix_acl_default";
1619 ret = glfs_getxattr(handle->data, path_p, key, buf, size);
1620 if (ret == -1 && errno == ERANGE) {
1621 ret = glfs_getxattr(handle->data, path_p, key, 0, 0);
1627 ret = glfs_getxattr(handle->data, path_p, key, buf, ret);
1631 /* retrieving the ACL from the xattr has finally failed, do a
1632 * mode-to-acl mapping */
1634 if (ret == -1 && errno == ENODATA) {
1635 ret = glfs_stat(handle->data, path_p, &st);
1637 result = mode_to_smb_acls(&st, mem_ctx);
1646 result = gluster_to_smb_acl(buf, ret, mem_ctx);
1651 static SMB_ACL_T vfs_gluster_sys_acl_get_fd(struct vfs_handle_struct *handle,
1652 struct files_struct *fsp,
1653 TALLOC_CTX *mem_ctx)
1655 struct smb_acl_t *result;
1657 ssize_t ret, size = GLUSTER_ACL_SIZE(20);
1661 glfd = *(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp);
1668 ret = glfs_fgetxattr(glfd, "system.posix_acl_access", buf, size);
1669 if (ret == -1 && errno == ERANGE) {
1670 ret = glfs_fgetxattr(glfd, "system.posix_acl_access", 0, 0);
1676 ret = glfs_fgetxattr(glfd, "system.posix_acl_access",
1681 /* retrieving the ACL from the xattr has finally failed, do a
1682 * mode-to-acl mapping */
1684 if (ret == -1 && errno == ENODATA) {
1685 ret = glfs_fstat(glfd, &st);
1687 result = mode_to_smb_acls(&st, mem_ctx);
1696 result = gluster_to_smb_acl(buf, ret, mem_ctx);
1701 static int vfs_gluster_sys_acl_set_file(struct vfs_handle_struct *handle,
1703 SMB_ACL_TYPE_T acltype,
1712 case SMB_ACL_TYPE_ACCESS:
1713 key = "system.posix_acl_access";
1715 case SMB_ACL_TYPE_DEFAULT:
1716 key = "system.posix_acl_default";
1723 size = smb_to_gluster_acl(theacl, 0, 0);
1726 size = smb_to_gluster_acl(theacl, buf, size);
1731 ret = glfs_setxattr(handle->data, name, key, buf, size, 0);
1736 static int vfs_gluster_sys_acl_set_fd(struct vfs_handle_struct *handle,
1737 struct files_struct *fsp,
1744 size = smb_to_gluster_acl(theacl, 0, 0);
1747 size = smb_to_gluster_acl(theacl, buf, size);
1752 ret = glfs_fsetxattr(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp),
1753 "system.posix_acl_access", buf, size, 0);
1757 static int vfs_gluster_sys_acl_delete_def_file(struct vfs_handle_struct *handle,
1760 return glfs_removexattr(handle->data, path, "system.posix_acl_default");
1763 static struct vfs_fn_pointers glusterfs_fns = {
1765 /* Disk Operations */
1767 .connect_fn = vfs_gluster_connect,
1768 .disconnect_fn = vfs_gluster_disconnect,
1769 .disk_free_fn = vfs_gluster_disk_free,
1770 .get_quota_fn = vfs_gluster_get_quota,
1771 .set_quota_fn = vfs_gluster_set_quota,
1772 .statvfs_fn = vfs_gluster_statvfs,
1773 .fs_capabilities_fn = vfs_gluster_fs_capabilities,
1775 .get_dfs_referrals_fn = NULL,
1777 /* Directory Operations */
1779 .opendir_fn = vfs_gluster_opendir,
1780 .fdopendir_fn = vfs_gluster_fdopendir,
1781 .readdir_fn = vfs_gluster_readdir,
1782 .seekdir_fn = vfs_gluster_seekdir,
1783 .telldir_fn = vfs_gluster_telldir,
1784 .rewind_dir_fn = vfs_gluster_rewinddir,
1785 .mkdir_fn = vfs_gluster_mkdir,
1786 .rmdir_fn = vfs_gluster_rmdir,
1787 .closedir_fn = vfs_gluster_closedir,
1788 .init_search_op_fn = vfs_gluster_init_search_op,
1790 /* File Operations */
1792 .open_fn = vfs_gluster_open,
1793 .create_file_fn = NULL,
1794 .close_fn = vfs_gluster_close,
1795 .read_fn = vfs_gluster_read,
1796 .pread_fn = vfs_gluster_pread,
1797 .pread_send_fn = vfs_gluster_pread_send,
1798 .pread_recv_fn = vfs_gluster_recv,
1799 .write_fn = vfs_gluster_write,
1800 .pwrite_fn = vfs_gluster_pwrite,
1801 .pwrite_send_fn = vfs_gluster_pwrite_send,
1802 .pwrite_recv_fn = vfs_gluster_recv,
1803 .lseek_fn = vfs_gluster_lseek,
1804 .sendfile_fn = vfs_gluster_sendfile,
1805 .recvfile_fn = vfs_gluster_recvfile,
1806 .rename_fn = vfs_gluster_rename,
1807 .fsync_fn = vfs_gluster_fsync,
1808 .fsync_send_fn = vfs_gluster_fsync_send,
1809 .fsync_recv_fn = vfs_gluster_fsync_recv,
1811 .stat_fn = vfs_gluster_stat,
1812 .fstat_fn = vfs_gluster_fstat,
1813 .lstat_fn = vfs_gluster_lstat,
1814 .get_alloc_size_fn = vfs_gluster_get_alloc_size,
1815 .unlink_fn = vfs_gluster_unlink,
1817 .chmod_fn = vfs_gluster_chmod,
1818 .fchmod_fn = vfs_gluster_fchmod,
1819 .chown_fn = vfs_gluster_chown,
1820 .fchown_fn = vfs_gluster_fchown,
1821 .lchown_fn = vfs_gluster_lchown,
1822 .chdir_fn = vfs_gluster_chdir,
1823 .getwd_fn = vfs_gluster_getwd,
1824 .ntimes_fn = vfs_gluster_ntimes,
1825 .ftruncate_fn = vfs_gluster_ftruncate,
1826 .fallocate_fn = vfs_gluster_fallocate,
1827 .lock_fn = vfs_gluster_lock,
1828 .kernel_flock_fn = vfs_gluster_kernel_flock,
1829 .linux_setlease_fn = vfs_gluster_linux_setlease,
1830 .getlock_fn = vfs_gluster_getlock,
1831 .symlink_fn = vfs_gluster_symlink,
1832 .readlink_fn = vfs_gluster_readlink,
1833 .link_fn = vfs_gluster_link,
1834 .mknod_fn = vfs_gluster_mknod,
1835 .realpath_fn = vfs_gluster_realpath,
1836 .chflags_fn = vfs_gluster_chflags,
1837 .file_id_create_fn = NULL,
1838 .copy_chunk_send_fn = NULL,
1839 .copy_chunk_recv_fn = NULL,
1840 .streaminfo_fn = NULL,
1841 .get_real_filename_fn = vfs_gluster_get_real_filename,
1842 .connectpath_fn = vfs_gluster_connectpath,
1844 .brl_lock_windows_fn = NULL,
1845 .brl_unlock_windows_fn = NULL,
1846 .brl_cancel_windows_fn = NULL,
1847 .strict_lock_fn = NULL,
1848 .strict_unlock_fn = NULL,
1849 .translate_name_fn = NULL,
1852 /* NT ACL Operations */
1853 .fget_nt_acl_fn = NULL,
1854 .get_nt_acl_fn = NULL,
1855 .fset_nt_acl_fn = NULL,
1856 .audit_file_fn = NULL,
1858 /* Posix ACL Operations */
1859 .chmod_acl_fn = NULL, /* passthrough to default */
1860 .fchmod_acl_fn = NULL, /* passthrough to default */
1861 .sys_acl_get_file_fn = vfs_gluster_sys_acl_get_file,
1862 .sys_acl_get_fd_fn = vfs_gluster_sys_acl_get_fd,
1863 .sys_acl_blob_get_file_fn = posix_sys_acl_blob_get_file,
1864 .sys_acl_blob_get_fd_fn = posix_sys_acl_blob_get_fd,
1865 .sys_acl_set_file_fn = vfs_gluster_sys_acl_set_file,
1866 .sys_acl_set_fd_fn = vfs_gluster_sys_acl_set_fd,
1867 .sys_acl_delete_def_file_fn = vfs_gluster_sys_acl_delete_def_file,
1870 .getxattr_fn = vfs_gluster_getxattr,
1871 .fgetxattr_fn = vfs_gluster_fgetxattr,
1872 .listxattr_fn = vfs_gluster_listxattr,
1873 .flistxattr_fn = vfs_gluster_flistxattr,
1874 .removexattr_fn = vfs_gluster_removexattr,
1875 .fremovexattr_fn = vfs_gluster_fremovexattr,
1876 .setxattr_fn = vfs_gluster_setxattr,
1877 .fsetxattr_fn = vfs_gluster_fsetxattr,
1879 /* AIO Operations */
1880 .aio_force_fn = vfs_gluster_aio_force,
1882 /* Offline Operations */
1883 .is_offline_fn = vfs_gluster_is_offline,
1884 .set_offline_fn = vfs_gluster_set_offline,
1886 /* Durable handle Operations */
1887 .durable_cookie_fn = NULL,
1888 .durable_disconnect_fn = NULL,
1889 .durable_reconnect_fn = NULL,
1892 NTSTATUS vfs_glusterfs_init(void);
1893 NTSTATUS vfs_glusterfs_init(void)
1895 return smb_register_vfs(SMB_VFS_INTERFACE_VERSION,
1896 "glusterfs", &glusterfs_fns);