summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2018-05-04 12:25:48 -0400
committerAmar Tumballi <amarts@redhat.com>2018-05-18 04:19:32 +0000
commitc2cf3f686f3ea0efd936d2eafc404fc9d2e0acc7 (patch)
tree05cf07ba57fa8510d698e6f9c049146aa98b5c3e /libglusterfs
parent7588be808db3fcfda337971990f02d2ebccba3d7 (diff)
make posix return errors when gfid2path key is absent
Change-Id: I3a8d452d00560dac5e0b7ff0b1835d1f20a59f91 updates: bz#1570962 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/syncop-utils.c18
1 files changed, 15 insertions, 3 deletions
diff --git a/libglusterfs/src/syncop-utils.c b/libglusterfs/src/syncop-utils.c
index 40ced03cb45..1ccda55e4c5 100644
--- a/libglusterfs/src/syncop-utils.c
+++ b/libglusterfs/src/syncop-utils.c
@@ -591,9 +591,21 @@ syncop_gfid_to_path_hard (inode_table_t *itable, xlator_t *subvol, uuid_t gfid,
if (ret < 0)
goto out;
- ret = dict_get_str (xattr, hard_resolve ?
- GFID2PATH_VIRT_XATTR_KEY : GFID_TO_PATH_KEY,
- &path);
+
+ /*
+ * posix will do dict_set_dynstr for GFID_TO_PATH_KEY i.e.
+ * for in memory search for the path. And for on disk xattr
+ * fetching of the path for the key GFID2PATH_VIRT_XATTR_KEY
+ * it uses dict_set_dynptr. So, for GFID2PATH_VIRT_XATTR_KEY
+ * use dict_get_ptr to avoid dict complaining about type
+ * mismatch (i.e. str vs ptr)
+ */
+ if (!hard_resolve)
+ ret = dict_get_str (xattr, GFID_TO_PATH_KEY, &path);
+ else
+ ret = dict_get_ptr (xattr, GFID2PATH_VIRT_XATTR_KEY,
+ (void **)&path);
+
if (ret || !path) {
ret = -EINVAL;
goto out;