[PATCH 1/2] vfs_ceph: fix ntimes_fn callback

Michael Adam obnox at samba.org
Tue Mar 17 09:34:10 MDT 2015


The patch content looks good.

Another formatting nitpick:
But we prefer to use braces around blocks even if
the just contain one command.

So even while the rest of the modules does not
strictly adhere to our README.Coding, would you
mind adapting the lines that you are adding?

Apart from that : reviewed-by: /me

Michael

On 2015-02-26 at 14:44 +0800, Yan, Zheng wrote:
> Add null timespec check for atime/mtime, also add code that stores
> create_time by EA.
> 
> Signed-off-by: Yan, Zheng <zyan at redhat.com>
> ---
>  source3/modules/vfs_ceph.c | 20 ++++++++++++++++++--
>  1 file changed, 18 insertions(+), 2 deletions(-)
> 
> diff --git a/source3/modules/vfs_ceph.c b/source3/modules/vfs_ceph.c
> index 0967428..8c56764 100644
> --- a/source3/modules/vfs_ceph.c
> +++ b/source3/modules/vfs_ceph.c
> @@ -753,8 +753,24 @@ static int cephwrap_ntimes(struct vfs_handle_struct *handle,
>  {
>  	struct utimbuf buf;
>  	int result;
> -	buf.actime = ft->atime.tv_sec;
> -	buf.modtime = ft->mtime.tv_sec;
> +
> +	if (null_timespec(ft->atime))
> +		buf.actime = smb_fname->st.st_ex_atime.tv_sec;
> +	else
> +		buf.actime = ft->atime.tv_sec;
> +
> +	if (null_timespec(ft->mtime))
> +		buf.modtime = smb_fname->st.st_ex_mtime.tv_sec;
> +	else
> +		buf.modtime = ft->mtime.tv_sec;
> +
> +	if (!null_timespec(ft->create_time))
> +		set_create_timespec_ea(handle->conn, smb_fname, ft->create_time);
> +
> +	if (buf.actime == smb_fname->st.st_ex_atime.tv_sec &&
> +	    buf.modtime == smb_fname->st.st_ex_mtime.tv_sec)
> +		return 0;
> +
>  	result = ceph_utime(handle->data, smb_fname->base_name, &buf);
>  	DEBUG(10, ("[CEPH] ntimes(%p, %s, {%ld, %ld, %ld, %ld}) = %d\n", handle, smb_fname_str_dbg(smb_fname),
>  				ft->mtime.tv_sec, ft->atime.tv_sec, ft->ctime.tv_sec,
> -- 
> 1.9.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20150317/57cf1ef4/attachment.pgp>


More information about the samba-technical mailing list