s3: VFS: Remove fsync_fn() from the VFS and all modules. VFS ABI change.
authorJeremy Allison <jra@samba.org>
Sat, 28 Apr 2018 00:06:10 +0000 (17:06 -0700)
committerRalph Boehme <slow@samba.org>
Tue, 1 May 2018 23:06:27 +0000 (01:06 +0200)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph B√∂hme <slow@samba.org>
Autobuild-Date(master): Wed May  2 01:06:28 CEST 2018 on sn-devel-144

examples/VFS/skel_opaque.c
examples/VFS/skel_transparent.c
source3/include/vfs.h
source3/modules/vfs_catia.c
source3/modules/vfs_ceph.c
source3/modules/vfs_default.c
source3/modules/vfs_full_audit.c
source3/modules/vfs_glusterfs.c
source3/modules/vfs_streams_xattr.c
source3/modules/vfs_time_audit.c
source3/smbd/vfs.c

index e6c066d..41215cc 100644 (file)
@@ -311,12 +311,6 @@ static int skel_rename(vfs_handle_struct *handle,
        return -1;
 }
 
-static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
-{
-       errno = ENOSYS;
-       return -1;
-}
-
 static struct tevent_req *skel_fsync_send(struct vfs_handle_struct *handle,
                                          TALLOC_CTX *mem_ctx,
                                          struct tevent_context *ev,
@@ -967,7 +961,6 @@ struct vfs_fn_pointers skel_opaque_fns = {
        .sendfile_fn = skel_sendfile,
        .recvfile_fn = skel_recvfile,
        .rename_fn = skel_rename,
-       .fsync_fn = skel_fsync,
        .fsync_send_fn = skel_fsync_send,
        .fsync_recv_fn = skel_fsync_recv,
        .stat_fn = skel_stat,
index 59d1634..7a82a55 100644 (file)
@@ -388,11 +388,6 @@ static int skel_rename(vfs_handle_struct *handle,
        return SMB_VFS_NEXT_RENAME(handle, smb_fname_src, smb_fname_dst);
 }
 
-static int skel_fsync(vfs_handle_struct *handle, files_struct *fsp)
-{
-       return SMB_VFS_NEXT_FSYNC(handle, fsp);
-}
-
 struct skel_fsync_state {
        int ret;
        struct vfs_aio_state vfs_aio_state;
@@ -1140,7 +1135,6 @@ struct vfs_fn_pointers skel_transparent_fns = {
        .sendfile_fn = skel_sendfile,
        .recvfile_fn = skel_recvfile,
        .rename_fn = skel_rename,
-       .fsync_fn = skel_fsync,
        .fsync_send_fn = skel_fsync_send,
        .fsync_recv_fn = skel_fsync_recv,
        .stat_fn = skel_stat,
index a31cb5a..6f940ed 100644 (file)
 /* Version 37 - Rename SMB_VFS_STRICT_LOCK to
                 SMB_VFS_STRICT_LOCK_CHECK */
 /* Version 38 - Remove SMB_VFS_INIT_SEARCH_OP */
+/* Version 39 - Remove SMB_VFS_FSYNC
+               Only implement async versions. */
 
-#define SMB_VFS_INTERFACE_VERSION 38
+#define SMB_VFS_INTERFACE_VERSION 39
 
 /*
     All intercepted VFS operations must be declared as static functions inside module source
@@ -707,7 +709,6 @@ struct vfs_fn_pointers {
        int (*rename_fn)(struct vfs_handle_struct *handle,
                         const struct smb_filename *smb_fname_src,
                         const struct smb_filename *smb_fname_dst);
-       int (*fsync_fn)(struct vfs_handle_struct *handle, struct files_struct *fsp);
        struct tevent_req *(*fsync_send_fn)(struct vfs_handle_struct *handle,
                                            TALLOC_CTX *mem_ctx,
                                            struct tevent_context *ev,
@@ -1208,8 +1209,6 @@ ssize_t smb_vfs_call_recvfile(struct vfs_handle_struct *handle, int fromfd,
 int smb_vfs_call_rename(struct vfs_handle_struct *handle,
                        const struct smb_filename *smb_fname_src,
                        const struct smb_filename *smb_fname_dst);
-int smb_vfs_call_fsync(struct vfs_handle_struct *handle,
-                      struct files_struct *fsp);
 
 struct tevent_req *smb_vfs_call_fsync_send(struct vfs_handle_struct *handle,
                                           TALLOC_CTX *mem_ctx,
index 6f90c4d..b8c61e2 100644 (file)
@@ -2078,23 +2078,6 @@ static off_t catia_lseek(vfs_handle_struct *handle,
        return result;
 }
 
-static int catia_fsync(vfs_handle_struct *handle, files_struct *fsp)
-{
-       struct catia_cache *cc = NULL;
-       int ret;
-
-       ret = CATIA_FETCH_FSP_PRE_NEXT(talloc_tos(), handle, fsp, &cc);
-       if (ret != 0) {
-               return -1;
-       }
-
-       ret = SMB_VFS_NEXT_FSYNC(handle, fsp);
-
-       CATIA_FETCH_FSP_POST_NEXT(&cc, fsp);
-
-       return ret;
-}
-
 struct catia_fsync_state {
        int ret;
        struct vfs_aio_state vfs_aio_state;
@@ -2495,7 +2478,6 @@ static struct vfs_fn_pointers vfs_catia_fns = {
        .pwrite_recv_fn = catia_pwrite_recv,
        .lseek_fn = catia_lseek,
        .rename_fn = catia_rename,
-       .fsync_fn = catia_fsync,
        .fsync_send_fn = catia_fsync_send,
        .fsync_recv_fn = catia_fsync_recv,
        .stat_fn = catia_stat,
index 656ce57..2062fe4 100644 (file)
@@ -562,14 +562,6 @@ static int cephwrap_rename(struct vfs_handle_struct *handle,
        WRAP_RETURN(result);
 }
 
-static int cephwrap_fsync(struct vfs_handle_struct *handle, files_struct *fsp)
-{
-       int result;
-       DBG_DEBUG("[CEPH] cephwrap_fsync\n");
-       result = ceph_fsync(handle->data, fsp->fh->fd, false);
-       WRAP_RETURN(result);
-}
-
 /*
  * Fake up an async ceph fsync by calling the sychronous API.
  */
@@ -1490,7 +1482,6 @@ static struct vfs_fn_pointers ceph_fns = {
        .sendfile_fn = cephwrap_sendfile,
        .recvfile_fn = cephwrap_recvfile,
        .rename_fn = cephwrap_rename,
-       .fsync_fn = cephwrap_fsync,
        .fsync_send_fn = cephwrap_fsync_send,
        .fsync_recv_fn = cephwrap_fsync_recv,
        .stat_fn = cephwrap_stat,
index e2efdab..6de0329 100644 (file)
@@ -1127,20 +1127,6 @@ static int vfswrap_rename(vfs_handle_struct *handle,
        return result;
 }
 
-static int vfswrap_fsync(vfs_handle_struct *handle, files_struct *fsp)
-{
-#ifdef HAVE_FSYNC
-       int result;
-
-       START_PROFILE(syscall_fsync);
-       result = fsync(fsp->fh->fd);
-       END_PROFILE(syscall_fsync);
-       return result;
-#else
-       return 0;
-#endif
-}
-
 static int vfswrap_stat(vfs_handle_struct *handle,
                        struct smb_filename *smb_fname)
 {
@@ -3036,7 +3022,6 @@ static struct vfs_fn_pointers vfs_default_fns = {
        .sendfile_fn = vfswrap_sendfile,
        .recvfile_fn = vfswrap_recvfile,
        .rename_fn = vfswrap_rename,
-       .fsync_fn = vfswrap_fsync,
        .fsync_send_fn = vfswrap_fsync_send,
        .fsync_recv_fn = vfswrap_fsync_recv,
        .stat_fn = vfswrap_stat,
index fbe1715..45d6544 100644 (file)
@@ -1286,18 +1286,6 @@ static int smb_full_audit_rename(vfs_handle_struct *handle,
        return result;    
 }
 
-static int smb_full_audit_fsync(vfs_handle_struct *handle, files_struct *fsp)
-{
-       int result;
-       
-       result = SMB_VFS_NEXT_FSYNC(handle, fsp);
-
-       do_log(SMB_VFS_OP_FSYNC, (result >= 0), handle, "%s",
-              fsp_str_do_log(fsp));
-
-       return result;    
-}
-
 struct smb_full_audit_fsync_state {
        vfs_handle_struct *handle;
        files_struct *fsp;
@@ -2531,7 +2519,6 @@ static struct vfs_fn_pointers vfs_full_audit_fns = {
        .sendfile_fn = smb_full_audit_sendfile,
        .recvfile_fn = smb_full_audit_recvfile,
        .rename_fn = smb_full_audit_rename,
-       .fsync_fn = smb_full_audit_fsync,
        .fsync_send_fn = smb_full_audit_fsync_send,
        .fsync_recv_fn = smb_full_audit_fsync_recv,
        .stat_fn = smb_full_audit_stat,
index 38abb78..5878c14 100644 (file)
@@ -931,12 +931,6 @@ static int vfs_gluster_rename(struct vfs_handle_struct *handle,
                           smb_fname_dst->base_name);
 }
 
-static int vfs_gluster_fsync(struct vfs_handle_struct *handle,
-                            files_struct *fsp)
-{
-       return glfs_fsync(*(glfs_fd_t **)VFS_FETCH_FSP_EXTENSION(handle, fsp));
-}
-
 static struct tevent_req *vfs_gluster_fsync_send(struct vfs_handle_struct
                                                 *handle, TALLOC_CTX *mem_ctx,
                                                 struct tevent_context *ev,
@@ -1471,7 +1465,6 @@ static struct vfs_fn_pointers glusterfs_fns = {
        .sendfile_fn = vfs_gluster_sendfile,
        .recvfile_fn = vfs_gluster_recvfile,
        .rename_fn = vfs_gluster_rename,
-       .fsync_fn = vfs_gluster_fsync,
        .fsync_send_fn = vfs_gluster_fsync_send,
        .fsync_recv_fn = vfs_gluster_fsync_recv,
 
index c653656..5355dd8 100644 (file)
@@ -1323,18 +1323,6 @@ static int streams_xattr_fchmod(vfs_handle_struct *handle,
        return 0;
 }
 
-static int streams_xattr_fsync(vfs_handle_struct *handle, files_struct *fsp)
-{
-       struct stream_io *sio =
-               (struct stream_io *)VFS_FETCH_FSP_EXTENSION(handle, fsp);
-
-       if (sio == NULL) {
-               return SMB_VFS_NEXT_FSYNC(handle, fsp);
-       }
-
-       return 0;
-}
-
 static ssize_t streams_xattr_fgetxattr(struct vfs_handle_struct *handle,
                                       struct files_struct *fsp,
                                       const char *name,
@@ -1683,7 +1671,6 @@ static struct vfs_fn_pointers vfs_streams_xattr_fns = {
 
        .fchown_fn = streams_xattr_fchown,
        .fchmod_fn = streams_xattr_fchmod,
-       .fsync_fn = streams_xattr_fsync,
 
        .fgetxattr_fn = streams_xattr_fgetxattr,
        .flistxattr_fn = streams_xattr_flistxattr,
index 4a0ec89..383f49b 100644 (file)
@@ -938,24 +938,6 @@ static int smb_time_audit_rename(vfs_handle_struct *handle,
        return result;
 }
 
-static int smb_time_audit_fsync(vfs_handle_struct *handle, files_struct *fsp)
-{
-       int result;
-       struct timespec ts1,ts2;
-       double timediff;
-
-       clock_gettime_mono(&ts1);
-       result = SMB_VFS_NEXT_FSYNC(handle, fsp);
-       clock_gettime_mono(&ts2);
-       timediff = nsec_time_diff(&ts2,&ts1)*1.0e-9;
-
-       if (timediff > audit_timeout) {
-               smb_time_audit_log_fsp("fsync", timediff, fsp);
-       }
-
-       return result;
-}
-
 struct smb_time_audit_fsync_state {
        struct files_struct *fsp;
        int ret;
@@ -2707,7 +2689,6 @@ static struct vfs_fn_pointers vfs_time_audit_fns = {
        .sendfile_fn = smb_time_audit_sendfile,
        .recvfile_fn = smb_time_audit_recvfile,
        .rename_fn = smb_time_audit_rename,
-       .fsync_fn = smb_time_audit_fsync,
        .fsync_send_fn = smb_time_audit_fsync_send,
        .fsync_recv_fn = smb_time_audit_fsync_recv,
        .stat_fn = smb_time_audit_stat,
index b29a5c5..f659c8f 100644 (file)
@@ -1921,13 +1921,6 @@ int smb_vfs_call_rename(struct vfs_handle_struct *handle,
        return handle->fns->rename_fn(handle, smb_fname_src, smb_fname_dst);
 }
 
-int smb_vfs_call_fsync(struct vfs_handle_struct *handle,
-                      struct files_struct *fsp)
-{
-       VFS_FIND(fsync);
-       return handle->fns->fsync_fn(handle, fsp);
-}
-
 struct smb_vfs_call_fsync_state {
        int (*recv_fn)(struct tevent_req *req, struct vfs_aio_state *vfs_aio_state);
        int retval;