[PATCH] fix vfs_gpfs dfree reporting

Christof Schmitt cs at samba.org
Mon Jan 11 19:00:18 UTC 2016


On Sun, Jan 10, 2016 at 12:21:29PM +0200, Uri Simchoni wrote:
> Hi,
> 
> I may have spotted a small bug in gpfs code - return value from
> disk_free_fn is not in units of 1K.
> I have no easy of testing it though.
> 
> Please review, if needed I can file in bugzilla. Beside adhering to
> interface conventions, this seems to have significance only in some
> combination of smb.conf parameters which may not even be valid for
> gpfs...
> 
> Thanks,
> Uri.

Hi Uri,

as far as i can see, this only affects the codepath in
vfs_allocate_file_space. All other codepaths calling into VFS DISK_FREE
only check whether the VFS call returns -1. What do you think about
simplifying this interface: Have the VFS DISK_FREE only return a bool to
indicate success, and to always read the available disk space from the
dfree argument?

Christof

> From 754b1402be8cbc1b8fe8525e9a1a7b7caeab5cad Mon Sep 17 00:00:00 2001
> From: Uri Simchoni <uri at samba.org>
> Date: Sun, 10 Jan 2016 11:57:56 +0200
> Subject: [PATCH] vfs_gpfs: fix disk free reporting
> 
> Modify the gpfs disk_free_fn VFS function to return the
> free space in units of 1K blocks.
> 
> Signed-off-by: Uri Simchoni <uri at samba.org>
> ---
>  source3/modules/vfs_gpfs.c | 10 +++++++++-
>  1 file changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/source3/modules/vfs_gpfs.c b/source3/modules/vfs_gpfs.c
> index dc53da0..ad48057 100644
> --- a/source3/modules/vfs_gpfs.c
> +++ b/source3/modules/vfs_gpfs.c
> @@ -2163,6 +2163,7 @@ static uint64_t vfs_gpfs_disk_free(vfs_handle_struct *handle, const char *path,
>  	struct gpfs_config_data *config;
>  	int err;
>  	time_t cur_time;
> +	uint64_t dfree_retval;
>  
>  	SMB_VFS_HANDLE_GET_DATA(handle, config, struct gpfs_config_data,
>  				return (uint64_t)-1);
> @@ -2205,7 +2206,14 @@ static uint64_t vfs_gpfs_disk_free(vfs_handle_struct *handle, const char *path,
>  	vfs_gpfs_disk_free_quota(qi_group, cur_time, dfree, dsize);
>  
>  	disk_norm(bsize, dfree, dsize);
> -	return *dfree;
> +
> +	if ((*bsize) < 1024) {
> +		dfree_retval = (*dfree)/(1024/(*bsize));
> +	} else {
> +		dfree_retval = ((*bsize)/1024)*(*dfree);
> +	}
> +
> +	return(dfree_retval);
>  }
>  
>  static uint32_t vfs_gpfs_capabilities(struct vfs_handle_struct *handle,
> -- 
> 2.4.3
> 




More information about the samba-technical mailing list