The branch, master has been updated via f42642e54e5 s3: VFS: Complete the replacement of SMB_VFS_LINK() -> SMB_VFS_LINKAT(). via fb75a3d5e98 s3: VFS: vfs_time_audit. Remove link_fn(). No longer used. via 1b2440107f5 s3: VFS: vfs_full_audit. Remove link_fn(). No longer used. via d31d52f16d1 s3: VFS: vfs_unityed_media. Remove link_fn(). No longer used. via 295aa5bd24a s3: VFS: vfs_syncops. Remove link_fn(). No longer used. via 3c3e62b79ee s3: VFS: vfs_snapper. Remove link_fn(). No longer used. via a5911429560 s3: VFS: vfs_shadow_copy2. Remove link_fn(). No longer used. via 38da902351b s3: VFS: vfs_media_harmony. Remove link_fn(). No longer used. via 751852ced40 s3: VFS: vfs_glusterfs. Remove link_fn(). No longer used. via f9c3b0b3cf4 s3: VFS: vfs_ceph_snapshots. Remove link_fn(). No longer used. via 228423811c9 s3: VFS: vfs_ceph. Remove link_fn(). No longer used. via 45851ead18a s3: VFS: vfs_cap. Remove link_fn(). No longer used. via ea637f002d0 s3: smbd: Make hardlink_internals() call SMB_VFS_LINKAT() instead of SMB_VFS_LINK() via d4f3d6ce12b s3: torture: Change cmd_link to call SMB_VFS_LINKAT(). via 6b6298b0239 s3: VFS: vfs_unityed_media. Implement linkat(). via a14d825a250 s3: VFS: vfs_time_audit. Implement linkat(). via 571624b866d s3: VFS: vfs_syncops. Implement linkat(). via dad377dbe47 s3: VFS: vfs_snapper. Implement linkat(). via c55b43ba13a s3: VFS: vfs_shadow_copy2. Implement linkat(). via 6e96b98f643 s3: VFS: vfs_media_harmony. Implement linkat(). via d75177454c5 s3: VFS: vfs_glusterfs. Implement linkat(). via 8e563426063 s3: VFS: vfs_full_audit. Implement linkat(). via 2f989023259 s3: VFS: vfs_ceph_snapshots. Implement linkat(). via 7d2ba253ada s3: VFS: vfs_ceph. Implement linkat(). via 648e771a61d s3: VFS: vfs_cap. Implement linkat(). via 6c3928e4e5b s3: VFS: Add SMB_VFS_LINKAT(). from 098486da91b vfs_glusterfs: Enable profiling for file system operations
https://git.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit f42642e54e560f8a6328cbc035b0bbcfdffcf728 Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:40:37 2019 -0700 s3: VFS: Complete the replacement of SMB_VFS_LINK() -> SMB_VFS_LINKAT(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> Autobuild-User(master): Jeremy Allison <j...@samba.org> Autobuild-Date(master): Tue Aug 20 22:26:17 UTC 2019 on sn-devel-184 commit fb75a3d5e98e2ae3210f4fc68f0fabbc27f09c18 Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:29:11 2019 -0700 s3: VFS: vfs_time_audit. Remove link_fn(). No longer used. NB, this will now fail smb_vfs_assert_all_fns() until we remove the rename_fn() from the VFS definitions. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit 1b2440107f5e987cf6ffe2806d6516547b593fd8 Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:21:42 2019 -0700 s3: VFS: vfs_full_audit. Remove link_fn(). No longer used. NB, this will now fail smb_vfs_assert_all_fns() until we remove the rename_fn() from the VFS definitions. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit d31d52f16d1554c6fb2f9426a39461206d8eb53d Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:28:16 2019 -0700 s3: VFS: vfs_unityed_media. Remove link_fn(). No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit 295aa5bd24ac113913e0ec9f22c59c8f56ba3ddc Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:27:25 2019 -0700 s3: VFS: vfs_syncops. Remove link_fn(). No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit 3c3e62b79ee791209d3696d1d84641e6f3f99981 Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:26:34 2019 -0700 s3: VFS: vfs_snapper. Remove link_fn(). No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit a5911429560fad0585bdc5b9084ad77070abbf96 Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:25:37 2019 -0700 s3: VFS: vfs_shadow_copy2. Remove link_fn(). No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit 38da902351b933bb6bb99e724e2f49987a8770d8 Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:24:53 2019 -0700 s3: VFS: vfs_media_harmony. Remove link_fn(). No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit 751852ced401fa1b3a6fe6c30bc89a23c342def0 Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:24:38 2019 -0700 s3: VFS: vfs_glusterfs. Remove link_fn(). No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit f9c3b0b3cf43ee08abd001f48307dbb7a332870f Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:21:04 2019 -0700 s3: VFS: vfs_ceph_snapshots. Remove link_fn(). No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit 228423811c97d4ee99df924699ae4c003df3e2f9 Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:19:22 2019 -0700 s3: VFS: vfs_ceph. Remove link_fn(). No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit 45851ead18ab687218648237e8651887e4d809fa Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:18:34 2019 -0700 s3: VFS: vfs_cap. Remove link_fn(). No longer used. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit ea637f002d0b0e30c29814fc6d8c137103deaa23 Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:16:48 2019 -0700 s3: smbd: Make hardlink_internals() call SMB_VFS_LINKAT() instead of SMB_VFS_LINK() Use conn->cwd_fsp as current src and dst fsp's. No logic change for now. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit d4f3d6ce12b2e2d504dcdbbb9b670ceff5cf3243 Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:14:03 2019 -0700 s3: torture: Change cmd_link to call SMB_VFS_LINKAT(). Use conn->cwd_fsp as current src and dst fsp's. No logic change for now. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit 6b6298b02392e30044efd9fbc236d9ffb8f1ec1a Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:08:22 2019 -0700 s3: VFS: vfs_unityed_media. Implement linkat(). Currently identical to link(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit a14d825a2507726f54ac3b4249e10968a2e35bd0 Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:05:55 2019 -0700 s3: VFS: vfs_time_audit. Implement linkat(). Currently identical to link(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit 571624b866d82bb1e9317c1f099049e0483bd1cc Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:04:02 2019 -0700 s3: VFS: vfs_syncops. Implement linkat(). Currently identical to link(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit dad377dbe4795f110da35bb751f800d6658fa7c0 Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 16:01:22 2019 -0700 s3: VFS: vfs_snapper. Implement linkat(). Currently identical to link(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit c55b43ba13a162d07befc27361632cdf2ef8aeb2 Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 15:59:27 2019 -0700 s3: VFS: vfs_shadow_copy2. Implement linkat(). Currently identical to link(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit 6e96b98f6436289d1804b6a2a767b411edeb291b Author: Jeremy Allison <j...@samba.org> Date: Fri Aug 16 15:57:15 2019 -0700 s3: VFS: vfs_media_harmony. Implement linkat(). Currently identical to link(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit d75177454c5612c7c68f637571f1bd3a3d34f220 Author: Jeremy Allison <j...@samba.org> Date: Wed Aug 14 13:01:39 2019 -0700 s3: VFS: vfs_glusterfs. Implement linkat(). Currently identical to link(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit 8e5634260632654b82f99170518b1086a2d9b9f1 Author: Jeremy Allison <j...@samba.org> Date: Wed Aug 14 11:45:35 2019 -0700 s3: VFS: vfs_full_audit. Implement linkat(). Currently identical to link(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit 2f989023259c92d3d5da7e0359a31f1a10c1dbb3 Author: Jeremy Allison <j...@samba.org> Date: Wed Aug 14 11:38:23 2019 -0700 s3: VFS: vfs_ceph_snapshots. Implement linkat(). Currently identical to link(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit 7d2ba253adaa3c6a57bd7048498e91a1ee0db712 Author: Jeremy Allison <j...@samba.org> Date: Wed Aug 14 11:32:30 2019 -0700 s3: VFS: vfs_ceph. Implement linkat(). Currently identical to link(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit 648e771a61d2d327ed3fe0f3a4eb0837a714b280 Author: Jeremy Allison <j...@samba.org> Date: Tue Aug 13 14:59:05 2019 -0700 s3: VFS: vfs_cap. Implement linkat(). Currently identical to link(). Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> commit 6c3928e4e5b724190843f75bec3e697af77a01a0 Author: Jeremy Allison <j...@samba.org> Date: Mon Aug 12 16:49:26 2019 -0700 s3: VFS: Add SMB_VFS_LINKAT(). Currently identical to SMB_VFS_LINK(). Next, move add to all VFS modules that implement link and eventually remove link. Signed-off-by: Jeremy Allison <j...@samba.org> Reviewed-by: Ralph Böhme <s...@samba.org> ----------------------------------------------------------------------- Summary of changes: examples/VFS/skel_opaque.c | 9 ++++++--- examples/VFS/skel_transparent.c | 16 ++++++++++++---- source3/include/smbprofile.h | 2 +- source3/include/vfs.h | 24 +++++++++++++++++------- source3/include/vfs_macros.h | 8 ++++---- source3/modules/vfs_cap.c | 18 +++++++++++++----- source3/modules/vfs_ceph.c | 13 ++++++++++--- source3/modules/vfs_ceph_snapshots.c | 16 ++++++++++++---- source3/modules/vfs_default.c | 24 ++++++++++++++++++------ source3/modules/vfs_full_audit.c | 20 +++++++++++++++----- source3/modules/vfs_glusterfs.c | 17 ++++++++++++----- source3/modules/vfs_media_harmony.c | 26 +++++++++++++++++++------- source3/modules/vfs_not_implemented.c | 11 +++++++---- source3/modules/vfs_shadow_copy2.c | 16 ++++++++++++---- source3/modules/vfs_snapper.c | 16 ++++++++++++---- source3/modules/vfs_syncops.c | 21 +++++++++++++++++---- source3/modules/vfs_time_audit.c | 19 ++++++++++++++----- source3/modules/vfs_unityed_media.c | 27 ++++++++++++++++++++------- source3/smbd/trans2.c | 10 +++++++++- source3/smbd/vfs.c | 16 ++++++++++++---- source3/torture/cmd_vfs.c | 9 ++++++++- 21 files changed, 250 insertions(+), 88 deletions(-) Changeset truncated at 500 lines: diff --git a/examples/VFS/skel_opaque.c b/examples/VFS/skel_opaque.c index 40e16c342ef..8de97e85147 100644 --- a/examples/VFS/skel_opaque.c +++ b/examples/VFS/skel_opaque.c @@ -473,9 +473,12 @@ static int skel_vfs_readlink(vfs_handle_struct *handle, return -1; } -static int skel_link(vfs_handle_struct *handle, +static int skel_linkat(vfs_handle_struct *handle, + files_struct *srcfsp, const struct smb_filename *old_smb_fname, - const struct smb_filename *new_smb_fname) + files_struct *dstfsp, + const struct smb_filename *new_smb_fname, + int flags) { errno = ENOSYS; return -1; @@ -1086,7 +1089,7 @@ static struct vfs_fn_pointers skel_opaque_fns = { .getlock_fn = skel_getlock, .symlink_fn = skel_symlink, .readlink_fn = skel_vfs_readlink, - .link_fn = skel_link, + .linkat_fn = skel_linkat, .mknod_fn = skel_mknod, .realpath_fn = skel_realpath, .chflags_fn = skel_chflags, diff --git a/examples/VFS/skel_transparent.c b/examples/VFS/skel_transparent.c index b5d44377463..015f72c1549 100644 --- a/examples/VFS/skel_transparent.c +++ b/examples/VFS/skel_transparent.c @@ -571,11 +571,19 @@ static int skel_vfs_readlink(vfs_handle_struct *handle, return SMB_VFS_NEXT_READLINK(handle, smb_fname, buf, bufsiz); } -static int skel_link(vfs_handle_struct *handle, +static int skel_linkat(vfs_handle_struct *handle, + files_struct *srcfsp, const struct smb_filename *old_smb_fname, - const struct smb_filename *new_smb_fname) + files_struct *dstfsp, + const struct smb_filename *new_smb_fname, + int flags) { - return SMB_VFS_NEXT_LINK(handle, old_smb_fname, new_smb_fname); + return SMB_VFS_NEXT_LINKAT(handle, + srcfsp, + old_smb_fname, + dstfsp, + new_smb_fname, + flags); } static int skel_mknod(vfs_handle_struct *handle, @@ -1352,7 +1360,7 @@ static struct vfs_fn_pointers skel_transparent_fns = { .getlock_fn = skel_getlock, .symlink_fn = skel_symlink, .readlink_fn = skel_vfs_readlink, - .link_fn = skel_link, + .linkat_fn = skel_linkat, .mknod_fn = skel_mknod, .realpath_fn = skel_realpath, .chflags_fn = skel_chflags, diff --git a/source3/include/smbprofile.h b/source3/include/smbprofile.h index c479c76d508..4568b19bfda 100644 --- a/source3/include/smbprofile.h +++ b/source3/include/smbprofile.h @@ -84,7 +84,7 @@ struct tevent_context; SMBPROFILE_STATS_BASIC(syscall_fcntl_getlock) \ SMBPROFILE_STATS_BASIC(syscall_readlink) \ SMBPROFILE_STATS_BASIC(syscall_symlink) \ - SMBPROFILE_STATS_BASIC(syscall_link) \ + SMBPROFILE_STATS_BASIC(syscall_linkat) \ SMBPROFILE_STATS_BASIC(syscall_mknod) \ SMBPROFILE_STATS_BASIC(syscall_realpath) \ SMBPROFILE_STATS_BASIC(syscall_get_quota) \ diff --git a/source3/include/vfs.h b/source3/include/vfs.h index dc407772079..c91b4a3789a 100644 --- a/source3/include/vfs.h +++ b/source3/include/vfs.h @@ -273,6 +273,7 @@ /* Version 42 - Remove share_access member from struct files_struct */ /* Version 42 - Make "lease" a const* in create_file_fn */ /* Version 42 - Move SMB_VFS_RENAME -> SMB_VFS_RENAMEAT */ +/* Version 42 - Move SMB_VFS_LINK -> SMB_VFS_LINKAT. */ #define SMB_VFS_INTERFACE_VERSION 42 @@ -799,9 +800,12 @@ struct vfs_fn_pointers { const struct smb_filename *smb_fname, char *buf, size_t bufsiz); - int (*link_fn)(struct vfs_handle_struct *handle, + int (*linkat_fn)(struct vfs_handle_struct *handle, + struct files_struct *srcfsp, const struct smb_filename *old_smb_fname, - const struct smb_filename *new_smb_fname); + struct files_struct *dstfsp, + const struct smb_filename *new_smb_fname, + int flags); int (*mknod_fn)(struct vfs_handle_struct *handle, const struct smb_filename *smb_fname, mode_t mode, @@ -1328,9 +1332,12 @@ int smb_vfs_call_readlink(struct vfs_handle_struct *handle, const struct smb_filename *smb_fname, char *buf, size_t bufsiz); -int smb_vfs_call_link(struct vfs_handle_struct *handle, +int smb_vfs_call_linkat(struct vfs_handle_struct *handle, + struct files_struct *srcfsp, const struct smb_filename *old_smb_fname, - const struct smb_filename *new_smb_fname); + struct files_struct *dstfsp, + const struct smb_filename *new_smb_fname, + int flags); int smb_vfs_call_mknod(struct vfs_handle_struct *handle, const struct smb_filename *smb_fname, mode_t mode, @@ -1754,9 +1761,12 @@ int vfs_not_implemented_vfs_readlink(vfs_handle_struct *handle, const struct smb_filename *smb_fname, char *buf, size_t bufsiz); -int vfs_not_implemented_link(vfs_handle_struct *handle, - const struct smb_filename *old_smb_fname, - const struct smb_filename *new_smb_fname); +int vfs_not_implemented_linkat(vfs_handle_struct *handle, + struct files_struct *srcfsp, + const struct smb_filename *old_smb_fname, + struct files_struct *dstfsp, + const struct smb_filename *new_smb_fname, + int flags); int vfs_not_implemented_mknod(vfs_handle_struct *handle, const struct smb_filename *smb_fname, mode_t mode, diff --git a/source3/include/vfs_macros.h b/source3/include/vfs_macros.h index 7bbdc97a6c6..1a90c74d775 100644 --- a/source3/include/vfs_macros.h +++ b/source3/include/vfs_macros.h @@ -306,10 +306,10 @@ #define SMB_VFS_NEXT_READLINK(handle, smb_fname, buf, bufsiz) \ smb_vfs_call_readlink((handle)->next, (smb_fname), (buf), (bufsiz)) -#define SMB_VFS_LINK(conn, oldpath, newpath) \ - smb_vfs_call_link((conn)->vfs_handles, (oldpath), (newpath)) -#define SMB_VFS_NEXT_LINK(handle, oldpath, newpath) \ - smb_vfs_call_link((handle)->next, (oldpath), (newpath)) +#define SMB_VFS_LINKAT(conn, srcfsp, oldpath, dstfsp, newpath, flags) \ + smb_vfs_call_linkat((conn)->vfs_handles, (srcfsp), (oldpath), (dstfsp), (newpath), (flags)) +#define SMB_VFS_NEXT_LINKAT(handle, srcfsp, oldpath, dstfsp, newpath, flags) \ + smb_vfs_call_linkat((handle)->next, (srcfsp), (oldpath), (dstfsp), (newpath), (flags)) #define SMB_VFS_MKNOD(conn, smb_fname, mode, dev) \ smb_vfs_call_mknod((conn)->vfs_handles, (smb_fname), (mode), (dev)) diff --git a/source3/modules/vfs_cap.c b/source3/modules/vfs_cap.c index ee48e542930..05c5426919c 100644 --- a/source3/modules/vfs_cap.c +++ b/source3/modules/vfs_cap.c @@ -585,9 +585,12 @@ static int cap_readlink(vfs_handle_struct *handle, return ret; } -static int cap_link(vfs_handle_struct *handle, - const struct smb_filename *old_smb_fname, - const struct smb_filename *new_smb_fname) +static int cap_linkat(vfs_handle_struct *handle, + files_struct *srcfsp, + const struct smb_filename *old_smb_fname, + files_struct *dstfsp, + const struct smb_filename *new_smb_fname, + int flags) { char *capold = capencode(talloc_tos(), old_smb_fname->base_name); char *capnew = capencode(talloc_tos(), new_smb_fname->base_name); @@ -623,7 +626,12 @@ static int cap_link(vfs_handle_struct *handle, errno = ENOMEM; return -1; } - ret = SMB_VFS_NEXT_LINK(handle, old_cap_smb_fname, new_cap_smb_fname); + ret = SMB_VFS_NEXT_LINKAT(handle, + srcfsp, + old_cap_smb_fname, + dstfsp, + new_cap_smb_fname, + flags); if (ret == -1) { saved_errno = errno; } @@ -1026,7 +1034,7 @@ static struct vfs_fn_pointers vfs_cap_fns = { .ntimes_fn = cap_ntimes, .symlink_fn = cap_symlink, .readlink_fn = cap_readlink, - .link_fn = cap_link, + .linkat_fn = cap_linkat, .mknod_fn = cap_mknod, .realpath_fn = cap_realpath, .sys_acl_get_file_fn = cap_sys_acl_get_file, diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c index 0a181327d27..93d5801136d 100644 --- a/source3/modules/vfs_ceph.c +++ b/source3/modules/vfs_ceph.c @@ -1156,14 +1156,21 @@ static int cephwrap_readlink(struct vfs_handle_struct *handle, WRAP_RETURN(result); } -static int cephwrap_link(struct vfs_handle_struct *handle, +static int cephwrap_linkat(struct vfs_handle_struct *handle, + files_struct *srcfsp, const struct smb_filename *old_smb_fname, - const struct smb_filename *new_smb_fname) + files_struct *dstfsp, + const struct smb_filename *new_smb_fname, + int flags) { int result = -1; DBG_DEBUG("[CEPH] link(%p, %s, %s)\n", handle, old_smb_fname->base_name, new_smb_fname->base_name); + + SMB_ASSERT(srcfsp == srcfsp->conn->cwd_fsp); + SMB_ASSERT(dstfsp == dstfsp->conn->cwd_fsp); + result = ceph_link(handle->data, old_smb_fname->base_name, new_smb_fname->base_name); @@ -1451,7 +1458,7 @@ static struct vfs_fn_pointers ceph_fns = { .getlock_fn = cephwrap_getlock, .symlink_fn = cephwrap_symlink, .readlink_fn = cephwrap_readlink, - .link_fn = cephwrap_link, + .linkat_fn = cephwrap_linkat, .mknod_fn = cephwrap_mknod, .realpath_fn = cephwrap_realpath, .chflags_fn = cephwrap_chflags, diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c index 5b4296f0caf..2911907adb0 100644 --- a/source3/modules/vfs_ceph_snapshots.c +++ b/source3/modules/vfs_ceph_snapshots.c @@ -826,9 +826,12 @@ static int ceph_snap_gmt_symlink(vfs_handle_struct *handle, return SMB_VFS_NEXT_SYMLINK(handle, link_contents, new_smb_fname); } -static int ceph_snap_gmt_link(vfs_handle_struct *handle, +static int ceph_snap_gmt_linkat(vfs_handle_struct *handle, + files_struct *srcfsp, const struct smb_filename *old_smb_fname, - const struct smb_filename *new_smb_fname) + files_struct *dstfsp, + const struct smb_filename *new_smb_fname, + int flags) { int ret; time_t timestamp_old = 0; @@ -854,7 +857,12 @@ static int ceph_snap_gmt_link(vfs_handle_struct *handle, errno = EROFS; return -1; } - return SMB_VFS_NEXT_LINK(handle, old_smb_fname, new_smb_fname); + return SMB_VFS_NEXT_LINKAT(handle, + srcfsp, + old_smb_fname, + dstfsp, + new_smb_fname, + flags); } static int ceph_snap_gmt_stat(vfs_handle_struct *handle, @@ -1601,7 +1609,7 @@ static struct vfs_fn_pointers ceph_snap_fns = { .disk_free_fn = ceph_snap_gmt_disk_free, .get_quota_fn = ceph_snap_gmt_get_quota, .renameat_fn = ceph_snap_gmt_renameat, - .link_fn = ceph_snap_gmt_link, + .linkat_fn = ceph_snap_gmt_linkat, .symlink_fn = ceph_snap_gmt_symlink, .stat_fn = ceph_snap_gmt_stat, .lstat_fn = ceph_snap_gmt_lstat, diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c index a2b6bf6e669..6de217eca9c 100644 --- a/source3/modules/vfs_default.c +++ b/source3/modules/vfs_default.c @@ -2663,15 +2663,27 @@ static int vfswrap_readlink(vfs_handle_struct *handle, return result; } -static int vfswrap_link(vfs_handle_struct *handle, +static int vfswrap_linkat(vfs_handle_struct *handle, + files_struct *srcfsp, const struct smb_filename *old_smb_fname, - const struct smb_filename *new_smb_fname) + files_struct *dstfsp, + const struct smb_filename *new_smb_fname, + int flags) { int result; - START_PROFILE(syscall_link); - result = link(old_smb_fname->base_name, new_smb_fname->base_name); - END_PROFILE(syscall_link); + START_PROFILE(syscall_linkat); + + SMB_ASSERT(srcfsp == srcfsp->conn->cwd_fsp); + SMB_ASSERT(dstfsp == dstfsp->conn->cwd_fsp); + + result = linkat(srcfsp->fh->fd, + old_smb_fname->base_name, + dstfsp->fh->fd, + new_smb_fname->base_name, + flags); + + END_PROFILE(syscall_linkat); return result; } @@ -3467,7 +3479,7 @@ static struct vfs_fn_pointers vfs_default_fns = { .getlock_fn = vfswrap_getlock, .symlink_fn = vfswrap_symlink, .readlink_fn = vfswrap_readlink, - .link_fn = vfswrap_link, + .linkat_fn = vfswrap_linkat, .mknod_fn = vfswrap_mknod, .realpath_fn = vfswrap_realpath, .chflags_fn = vfswrap_chflags, diff --git a/source3/modules/vfs_full_audit.c b/source3/modules/vfs_full_audit.c index e9e9e132b0a..836d4de8b4e 100644 --- a/source3/modules/vfs_full_audit.c +++ b/source3/modules/vfs_full_audit.c @@ -154,6 +154,7 @@ typedef enum _vfs_op_type { SMB_VFS_OP_SYMLINK, SMB_VFS_OP_READLINK, SMB_VFS_OP_LINK, + SMB_VFS_OP_LINKAT, SMB_VFS_OP_MKNOD, SMB_VFS_OP_REALPATH, SMB_VFS_OP_CHFLAGS, @@ -297,6 +298,7 @@ static struct { { SMB_VFS_OP_SYMLINK, "symlink" }, { SMB_VFS_OP_READLINK, "readlink" }, { SMB_VFS_OP_LINK, "link" }, + { SMB_VFS_OP_LINKAT, "linkat" }, { SMB_VFS_OP_MKNOD, "mknod" }, { SMB_VFS_OP_REALPATH, "realpath" }, { SMB_VFS_OP_CHFLAGS, "chflags" }, @@ -1754,15 +1756,23 @@ static int smb_full_audit_readlink(vfs_handle_struct *handle, return result; } -static int smb_full_audit_link(vfs_handle_struct *handle, +static int smb_full_audit_linkat(vfs_handle_struct *handle, + files_struct *srcfsp, const struct smb_filename *old_smb_fname, - const struct smb_filename *new_smb_fname) + files_struct *dstfsp, + const struct smb_filename *new_smb_fname, + int flags) { int result; - result = SMB_VFS_NEXT_LINK(handle, old_smb_fname, new_smb_fname); + result = SMB_VFS_NEXT_LINKAT(handle, + srcfsp, + old_smb_fname, + dstfsp, + new_smb_fname, + flags); - do_log(SMB_VFS_OP_LINK, (result >= 0), handle, + do_log(SMB_VFS_OP_LINKAT, (result >= 0), handle, "%s|%s", old_smb_fname->base_name, new_smb_fname->base_name); return result; @@ -2876,7 +2886,7 @@ static struct vfs_fn_pointers vfs_full_audit_fns = { .getlock_fn = smb_full_audit_getlock, .symlink_fn = smb_full_audit_symlink, .readlink_fn = smb_full_audit_readlink, - .link_fn = smb_full_audit_link, + .linkat_fn = smb_full_audit_linkat, .mknod_fn = smb_full_audit_mknod, .realpath_fn = smb_full_audit_realpath, .chflags_fn = smb_full_audit_chflags, diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index fd60926d815..09299bc70c5 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -1661,17 +1661,24 @@ static int vfs_gluster_readlink(struct vfs_handle_struct *handle, return ret; } -static int vfs_gluster_link(struct vfs_handle_struct *handle, +static int vfs_gluster_linkat(struct vfs_handle_struct *handle, + files_struct *srcfsp, const struct smb_filename *old_smb_fname, - const struct smb_filename *new_smb_fname) + files_struct *dstfsp, + const struct smb_filename *new_smb_fname, + int flags) { int ret; - START_PROFILE(syscall_link); + START_PROFILE(syscall_linkat); + + SMB_ASSERT(srcfsp == srcfsp->conn->cwd_fsp); + SMB_ASSERT(dstfsp == dstfsp->conn->cwd_fsp); + ret = glfs_link(handle->data, old_smb_fname->base_name, new_smb_fname->base_name); - END_PROFILE(syscall_link); + END_PROFILE(syscall_linkat); return ret; } @@ -1897,7 +1904,7 @@ static struct vfs_fn_pointers glusterfs_fns = { .getlock_fn = vfs_gluster_getlock, .symlink_fn = vfs_gluster_symlink, .readlink_fn = vfs_gluster_readlink, - .link_fn = vfs_gluster_link, + .linkat_fn = vfs_gluster_linkat, .mknod_fn = vfs_gluster_mknod, .realpath_fn = vfs_gluster_realpath, .chflags_fn = vfs_gluster_chflags, diff --git a/source3/modules/vfs_media_harmony.c b/source3/modules/vfs_media_harmony.c index 7333236497d..d6a8de2d2cc 100644 --- a/source3/modules/vfs_media_harmony.c +++ b/source3/modules/vfs_media_harmony.c @@ -1785,20 +1785,26 @@ out: * Success: return 0 * Failure: set errno, return -1 */ -static int mh_link(vfs_handle_struct *handle, +static int mh_linkat(vfs_handle_struct *handle, + files_struct *srcfsp, const struct smb_filename *old_smb_fname, - const struct smb_filename *new_smb_fname) + files_struct *dstfsp, + const struct smb_filename *new_smb_fname, + int flags) { int status; struct smb_filename *oldclientFname = NULL; struct smb_filename *newclientFname = NULL; - DEBUG(MH_INFO_DEBUG, ("Entering mh_link\n")); + DEBUG(MH_INFO_DEBUG, ("Entering mh_linkat\n")); if (!is_in_media_files(old_smb_fname->base_name) && !is_in_media_files(new_smb_fname->base_name)) { - status = SMB_VFS_NEXT_LINK(handle, + status = SMB_VFS_NEXT_LINKAT(handle, + srcfsp, old_smb_fname, - new_smb_fname); + dstfsp, + new_smb_fname, + flags); goto out; } @@ -1813,7 +1819,13 @@ static int mh_link(vfs_handle_struct *handle, goto err; } - status = SMB_VFS_NEXT_LINK(handle, oldclientFname, newclientFname); + status = SMB_VFS_NEXT_LINKAT(handle, + srcfsp, + oldclientFname, + dstfsp, + newclientFname, + flags); + err: TALLOC_FREE(newclientFname); TALLOC_FREE(oldclientFname); @@ -2301,7 +2313,7 @@ static struct vfs_fn_pointers vfs_mh_fns = { .ntimes_fn = mh_ntimes, .symlink_fn = mh_symlink, .readlink_fn = mh_readlink, - .link_fn = mh_link, + .linkat_fn = mh_linkat, .mknod_fn = mh_mknod, .realpath_fn = mh_realpath, .chflags_fn = mh_chflags, diff --git a/source3/modules/vfs_not_implemented.c b/source3/modules/vfs_not_implemented.c index 0a88f9e08cb..9a6847e83e0 100644 --- a/source3/modules/vfs_not_implemented.c +++ b/source3/modules/vfs_not_implemented.c @@ -471,9 +471,12 @@ int vfs_not_implemented_vfs_readlink(vfs_handle_struct *handle, return -1; } -int vfs_not_implemented_link(vfs_handle_struct *handle, - const struct smb_filename *old_smb_fname, - const struct smb_filename *new_smb_fname) +int vfs_not_implemented_linkat(vfs_handle_struct *handle, + files_struct *srcfsp, + const struct smb_filename *old_smb_fname, + files_struct *dstfsp, + const struct smb_filename *new_smb_fname, + int flags) { errno = ENOSYS; -- Samba Shared Repository