From: Noel Power Date: Fri, 19 Feb 2021 14:51:14 +0000 (+0000) Subject: s3/modules: ceph_snapshots: Add missing fsetxattr_fn implementation X-Git-Tag: tevent-0.11.0~1573 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a7d81d8e27900a93f56b76e95063b998bdda9bc6;p=thirdparty%2Fsamba.git s3/modules: ceph_snapshots: Add missing fsetxattr_fn implementation Signed-off-by: Noel Power Reviewed-by: Jeremy Allison --- diff --git a/source3/modules/vfs_ceph_snapshots.c b/source3/modules/vfs_ceph_snapshots.c index 9d93b8ba9da..a6d06df98c6 100644 --- a/source3/modules/vfs_ceph_snapshots.c +++ b/source3/modules/vfs_ceph_snapshots.c @@ -1342,6 +1342,31 @@ static int ceph_snap_gmt_setxattr(struct vfs_handle_struct *handle, aname, value, size, flags); } +static int ceph_snap_gmt_fsetxattr(struct vfs_handle_struct *handle, + struct files_struct *fsp, + const char *aname, const void *value, + size_t size, int flags) +{ + const struct smb_filename *csmb_fname = NULL; + time_t timestamp = 0; + int ret; + + csmb_fname = fsp->fsp_name; + ret = ceph_snap_gmt_strip_snapshot(handle, + csmb_fname, + ×tamp, NULL, 0); + if (ret < 0) { + errno = -ret; + return -1; + } + if (timestamp != 0) { + errno = EROFS; + return -1; + } + return SMB_VFS_NEXT_FSETXATTR(handle, fsp, + aname, value, size, flags); +} + static int ceph_snap_gmt_get_real_filename(struct vfs_handle_struct *handle, const struct smb_filename *path, const char *name, @@ -1492,6 +1517,7 @@ static struct vfs_fn_pointers ceph_snap_fns = { .getxattrat_recv_fn = vfs_not_implemented_getxattrat_recv, .removexattr_fn = ceph_snap_gmt_removexattr, .setxattr_fn = ceph_snap_gmt_setxattr, + .fsetxattr_fn = ceph_snap_gmt_fsetxattr, .chflags_fn = ceph_snap_gmt_chflags, .get_real_filename_fn = ceph_snap_gmt_get_real_filename, };