From bc71cd035c816de4ca98002860496bf8f5d50fe3 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 27 Apr 2018 17:06:10 -0700 Subject: [PATCH] s3: VFS: Remove fsync_fn() from the VFS and all modules. VFS ABI change. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme Autobuild-User(master): Ralph Böhme Autobuild-Date(master): Wed May 2 01:06:28 CEST 2018 on sn-devel-144 --- examples/VFS/skel_opaque.c | 7 ------- examples/VFS/skel_transparent.c | 6 ------ source3/include/vfs.h | 7 +++---- source3/modules/vfs_catia.c | 18 ------------------ source3/modules/vfs_ceph.c | 9 --------- source3/modules/vfs_default.c | 15 --------------- source3/modules/vfs_full_audit.c | 13 ------------- source3/modules/vfs_glusterfs.c | 7 ------- source3/modules/vfs_streams_xattr.c | 13 ------------- source3/modules/vfs_time_audit.c | 19 ------------------- source3/smbd/vfs.c | 7 ------- 11 files changed, 3 insertions(+), 118 deletions(-) diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index e6c066d2eb8e..41215ccf911e 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -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, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index 59d16340025a..7a82a55a2afe 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -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, diff --git a/source3/include/vfs.h b/source3/include/vfs.h index a31cb5aeaf2d..6f940edeeaa0 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -245,8 +245,10 @@ /* 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, diff --git a/source3/modules/vfs_catia.c b/source3/modules/vfs_catia.c index 6f90c4d97bca..b8c61e26ab8c 100644 --- a/source3/modules/vfs_catia.c +++ b/source3/modules/vfs_catia.c @@ -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, diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 656ce57009fb..2062fe474620 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -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, diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index e2efdabf47ce..6de0329b3373 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -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, diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index fbe1715b90e0..45d6544b5c2d 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -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, diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 38abb78f1f3b..5878c14aba77 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -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, diff --git a/source3/modules/vfs_streams_xattr.c b/source3/modules/vfs_streams_xattr.c index c653656e5f83..5355dd8ca443 100644 --- a/source3/modules/vfs_streams_xattr.c +++ b/source3/modules/vfs_streams_xattr.c @@ -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, diff --git a/source3/modules/vfs_time_audit.c b/source3/modules/vfs_time_audit.c index 4a0ec89f0443..383f49b7b22d 100644 --- a/source3/modules/vfs_time_audit.c +++ b/source3/modules/vfs_time_audit.c @@ -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, diff --git a/source3/smbd/vfs.c b/source3/smbd/vfs.c index b29a5c54acc0..f659c8f2783c 100644 --- a/source3/smbd/vfs.c +++ b/source3/smbd/vfs.c @@ -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; -- 2.34.1