From: Jeremy Allison Date: Wed, 4 Sep 2019 22:43:44 +0000 (-0700) Subject: s3: VFS: vfs_ceph_snapshots. Implement mkdirat(). X-Git-Tag: talloc-2.3.1~902 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0c5825debf5208c3629e55b9ec946ff3021fb1e6;p=thirdparty%2Fsamba.git s3: VFS: vfs_ceph_snapshots. Implement mkdirat(). Currently identical to mkdir(). Signed-off-by: Jeremy Allison Reviewed-by: Ralph Boehme --- diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c index 3980067816d..fb5ea46c556 100644 --- a/source3/modules/vfs_ceph_snapshots.c +++ b/source3/modules/vfs_ceph_snapshots.c @@ -1331,6 +1331,31 @@ static int ceph_snap_gmt_mkdir(vfs_handle_struct *handle, return SMB_VFS_NEXT_MKDIR(handle, csmb_fname, mode); } +static int ceph_snap_gmt_mkdirat(vfs_handle_struct *handle, + struct files_struct *dirfsp, + const struct smb_filename *csmb_fname, + mode_t mode) +{ + 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_MKDIRAT(handle, + dirfsp, + csmb_fname, + mode); +} + static int ceph_snap_gmt_rmdir(vfs_handle_struct *handle, const struct smb_filename *csmb_fname) { @@ -1644,6 +1669,7 @@ static struct vfs_fn_pointers ceph_snap_fns = { .fget_nt_acl_fn = ceph_snap_gmt_fget_nt_acl, .get_nt_acl_fn = ceph_snap_gmt_get_nt_acl, .mkdir_fn = ceph_snap_gmt_mkdir, + .mkdirat_fn = ceph_snap_gmt_mkdirat, .rmdir_fn = ceph_snap_gmt_rmdir, .getxattr_fn = ceph_snap_gmt_getxattr, .getxattrat_send_fn = vfs_not_implemented_getxattrat_send,