From a1c06667d6e2653801a34aae6a5f2dd952a86ae2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Tue, 20 Aug 2019 16:52:36 -0700 Subject: [PATCH] 3: VFS: vfs_ceph_snapshots. Implement mknodat(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently identical to mknod(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Böhme --- source3/modules/vfs_ceph_snapshots.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c index 2911907adb0..f98a60267e8 100644 --- a/source3/modules/vfs_ceph_snapshots.c +++ b/source3/modules/vfs_ceph_snapshots.c @@ -1157,6 +1157,33 @@ static int ceph_snap_gmt_mknod(vfs_handle_struct *handle, return SMB_VFS_NEXT_MKNOD(handle, csmb_fname, mode, dev); } +static int ceph_snap_gmt_mknodat(vfs_handle_struct *handle, + files_struct *dirfsp, + const struct smb_filename *csmb_fname, + mode_t mode, + SMB_DEV_T dev) +{ + time_t timestamp = 0; + int ret; + + ret = ceph_snap_gmt_strip_snapshot(handle, + csmb_fname->base_name, + ×tamp, NULL, 0); + if (ret < 0) { + errno = -ret; + return -1; + } + if (timestamp != 0) { + errno = EROFS; + return -1; + } + return SMB_VFS_NEXT_MKNODAT(handle, + dirfsp, + csmb_fname, + mode, + dev); +} + static struct smb_filename *ceph_snap_gmt_realpath(vfs_handle_struct *handle, TALLOC_CTX *ctx, const struct smb_filename *csmb_fname) @@ -1621,6 +1648,7 @@ static struct vfs_fn_pointers ceph_snap_fns = { .ntimes_fn = ceph_snap_gmt_ntimes, .readlink_fn = ceph_snap_gmt_readlink, .mknod_fn = ceph_snap_gmt_mknod, + .mknodat_fn = ceph_snap_gmt_mknodat, .realpath_fn = ceph_snap_gmt_realpath, .get_nt_acl_fn = ceph_snap_gmt_get_nt_acl, .fget_nt_acl_fn = ceph_snap_gmt_fget_nt_acl,