[PATCH] vfs_glusterfs: New file creation fix.

Jeremy Allison jra at samba.org
Thu Jun 20 17:06:42 MDT 2013


On Wed, Jun 19, 2013 at 10:36:14PM -0400, Jose Rivera wrote:
> When a new document is created in explorer, a check for file_exist is made.
> vfs_gluster_get_real_filename was returning 0 even when the file did not
> exist.
> 
> Credit to Raghavendra Talur <rtalur at redhat.com>
>       and Anand Avati <avati at redhat.com>
> 
> --Jose

> From e28cfe7cff260800b5081639f8c50cfff9f742a0 Mon Sep 17 00:00:00 2001
> From: Raghavendra Talur <rtalur at redhat.com>
> Date: Wed, 19 Jun 2013 21:28:50 -0500
> Subject: [PATCH] vfs_glusterfs: New file creation fix.
> 
> When a new document is created in explorer, a check for file_exist is made.
> vfs_gluster_get_real_filename was returning 0 even when the file did not
> exist.
> ---
>  source3/modules/vfs_glusterfs.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
> index 24e1bda..1585238 100644
> --- a/source3/modules/vfs_glusterfs.c
> +++ b/source3/modules/vfs_glusterfs.c
> @@ -899,6 +899,10 @@ static int vfs_gluster_get_real_filename(struct vfs_handle_struct *handle,
>  		return -1;
>  	}
>  
> +	if (ret < 0) {
> +		return -1;
> +	}
> +
>  	*found_name = talloc_strdup(mem_ctx, val_buf);
>  	if (found_name[0] == NULL) {
>  		errno = ENOMEM;
> -- 
> 1.8.1.4

FYI. Found at the Microsoft Interop event.

Looks good to me for Team member review (although I'd probably
move the -1 return into the previous bracketed code as it's
already checking for -1) - something like this:

diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c
index 24e1bda..1323e0e 100644
--- a/source3/modules/vfs_glusterfs.c
+++ b/source3/modules/vfs_glusterfs.c
@@ -894,8 +894,10 @@ static int vfs_gluster_get_real_filename(struct vfs_handle_struct *handle,
                 "user.glusterfs.get_real_filename:%s", name);
 
        ret = glfs_getxattr(handle->data, path, key_buf, val_buf, NAME_MAX + 1);
-       if (ret == -1 && errno == ENODATA) {
-               errno = EOPNOTSUPP;
+       if (ret == -1) {
+               if (errno == ENODATA) {
+                       errno = EOPNOTSUPP;
+               }
                return -1;
        }

but I'm not too hung up on it.

Can we get another Team member review and I'll push ?

Thanks,

	Jeremy.



More information about the samba-technical mailing list