diff options
author | Jiffin Tony Thottan <jthottan@gmail.com> | 2016-02-22 16:50:12 +0530 |
---|---|---|
committer | Kaleb KEITHLEY <kkeithle@redhat.com> | 2016-02-25 11:58:02 -0800 |
commit | b29822556d7ba83dc229d57eb29e141fc27b025e (patch) | |
tree | 7d0704dd18b9b9aeec51cd4058ced21f8a07132f /api/src | |
parent | d9cc672719b96168c46bc82334f44efc010adad5 (diff) |
gfapi : fixing listxattr call for handle ops
Currently listxattr is called as part of glfs_h_getxattrs() when NULL is
passed to name field, but glfs_h_getxattrs_common() inside it will error
out if name is NULL. Therefore listxattr is broken for handle ops.
Upstream reference
>Change-Id: I9ced6e33525e1e1a50298972e4922c954fc2b223
>BUG: 1310620
>Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
>Reviewed-on: http://review.gluster.org/13482
>Reviewed-by: Niels de Vos <ndevos@redhat.com>
>Smoke: Gluster Build System <jenkins@build.gluster.com>
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
>(cherry picked from commit 0bc54f3ea7a56040df4a67b8626200b47fa3d779)
Change-Id: Ib88c12e5c2a1841e96a65e672f40b44ac9f491a9
BUG: 1311411
Signed-off-by: Jiffin Tony Thottan <jthottan@redhat.com>
Reviewed-on: http://review.gluster.org/13504
Smoke: Gluster Build System <jenkins@build.gluster.com>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaleb KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'api/src')
-rw-r--r-- | api/src/glfs-handleops.c | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/api/src/glfs-handleops.c b/api/src/glfs-handleops.c index e8fbae4074e..ac648141eb0 100644 --- a/api/src/glfs-handleops.c +++ b/api/src/glfs-handleops.c @@ -313,7 +313,8 @@ GFAPI_SYMVER_PUBLIC_DEFAULT(glfs_h_getattrs, 3.4.2); int glfs_h_getxattrs_common (struct glfs *fs, struct glfs_object *object, - dict_t **xattr, const char *name) + dict_t **xattr, const char *name, + gf_boolean_t is_listxattr) { int ret = 0; xlator_t *subvol = NULL; @@ -326,16 +327,17 @@ glfs_h_getxattrs_common (struct glfs *fs, struct glfs_object *object, return -1; } - if (!name || *name == '\0') { - errno = EINVAL; - return -1; - } + if (!is_listxattr) { + if (!name || *name == '\0') { + errno = EINVAL; + return -1; + } - if (strlen(name) > GF_XATTR_NAME_MAX) { - errno = ENAMETOOLONG; - return -1; + if (strlen(name) > GF_XATTR_NAME_MAX) { + errno = ENAMETOOLONG; + return -1; + } } - /* get the active volume */ subvol = glfs_active_subvol (fs); if (!subvol) { @@ -385,7 +387,8 @@ pub_glfs_h_getxattrs (struct glfs *fs, struct glfs_object *object, DECLARE_OLD_THIS; __GLFS_ENTRY_VALIDATE_FS (fs, invalid_fs); - ret = glfs_h_getxattrs_common (fs, object, &xattr, name); + ret = glfs_h_getxattrs_common (fs, object, &xattr, name, + (name == NULL)); if (ret) goto out; @@ -2083,7 +2086,8 @@ pub_glfs_h_acl_get (struct glfs *fs, struct glfs_object *object, } else new_object = object; - ret = glfs_h_getxattrs_common (fs, new_object, &xattr, acl_key); + ret = glfs_h_getxattrs_common (fs, new_object, &xattr, acl_key, + _gf_false); if (ret) goto out; |