[PATCH] vfs_ceph: add fs_capabilities hook to avoid local statvfs

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH] vfs_ceph: add fs_capabilities hook to avoid local statvfs

Samba - samba-technical mailing list
Patch attached. Feedback/push appreciated.

Cheers, David

0001-vfs_ceph-add-fs_capabilities-hook-to-avoid-local-sta.patch (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] vfs_ceph: add fs_capabilities hook to avoid local statvfs

Samba - samba-technical mailing list
On Wed, Jan 10, 2018 at 01:45:04AM +0100, David Disseldorp via samba-technical wrote:
> Patch attached. Feedback/push appreciated.

Oh, yes - sys_statvfs() against a ceph filesystem path isn't
good. RB+ and pushed.

As an additional patch, should we change vfswrap_fs_capabilities()
to go through SMB_VFS_STATVFS() instead of calling locally, or
is there a reason for calling the system function (I have a
vague recollection around this) ?

Jeremy.

> From 97335a18bac7cd2d1445b9de0358ceacdbb16a3f Mon Sep 17 00:00:00 2001
> From: David Disseldorp <[hidden email]>
> Date: Wed, 10 Jan 2018 01:37:14 +0100
> Subject: [PATCH] vfs_ceph: add fs_capabilities hook to avoid local statvfs
>
> Adding the fs_capabilities() hook to the CephFS VFS module avoids
> fallback to the vfs_default code-path, which calls statvfs() against the
> share path on the *local* filesystem.
>
> Bug: https://bugzilla.samba.org/show_bug.cgi?id=13208
>
> Signed-off-by: David Disseldorp <[hidden email]>
> ---
>  source3/modules/vfs_ceph.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
> index b4a7ceef105..d61213110e0 100644
> --- a/source3/modules/vfs_ceph.c
> +++ b/source3/modules/vfs_ceph.c
> @@ -270,6 +270,20 @@ static int cephwrap_statvfs(struct vfs_handle_struct *handle,
>   return ret;
>  }
>  
> +static uint32_t cephwrap_fs_capabilities(struct vfs_handle_struct *handle,
> + enum timestamp_set_resolution *p_ts_res)
> +{
> + uint32_t caps = FILE_CASE_SENSITIVE_SEARCH | FILE_CASE_PRESERVED_NAMES;
> +
> +#ifdef HAVE_CEPH_STATX
> + *p_ts_res = TIMESTAMP_SET_NT_OR_BETTER;
> +#else
> + *p_ts_res = TIMESTAMP_SET_MSEC;
> +#endif
> +
> + return caps;
> +}
> +
>  /* Directory operations */
>  
>  static DIR *cephwrap_opendir(struct vfs_handle_struct *handle,
> @@ -1399,6 +1413,7 @@ static struct vfs_fn_pointers ceph_fns = {
>   .get_quota_fn = cephwrap_get_quota,
>   .set_quota_fn = cephwrap_set_quota,
>   .statvfs_fn = cephwrap_statvfs,
> + .fs_capabilities_fn = cephwrap_fs_capabilities,
>  
>   /* Directory operations */
>  
> --
> 2.13.6
>


Reply | Threaded
Open this post in threaded view
|

Re: [PATCH] vfs_ceph: add fs_capabilities hook to avoid local statvfs

Samba - samba-technical mailing list
On Tue, 9 Jan 2018 17:05:22 -0800, Jeremy Allison wrote:

> On Wed, Jan 10, 2018 at 01:45:04AM +0100, David Disseldorp via samba-technical wrote:
> > Patch attached. Feedback/push appreciated.  
>
> Oh, yes - sys_statvfs() against a ceph filesystem path isn't
> good. RB+ and pushed.

Thanks Jeremy.

> As an additional patch, should we change vfswrap_fs_capabilities()
> to go through SMB_VFS_STATVFS() instead of calling locally, or
> is there a reason for calling the system function (I have a
> vague recollection around this) ?

Agreed, I think it makes sense to use the VFS hook here. Please see
attached.

As a side note, it'd be nice to have a stack based synthetic_smb_fname()
helper, and get rid of quite a few (IMO) ugly talloc_tos() callers.

Cheers, David

0001-vfs_default-use-VFS-statvfs-macro-in-fs_capabilities.patch (1K) Download Attachment