summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorRaghavendra Bhat <raghavendra@redhat.com>2018-05-04 12:25:48 -0400
committerShyamsundar Ranganathan <srangana@redhat.com>2018-05-22 10:28:30 +0000
commit8d22afce10157fa473b169754829b7646d10e108 (patch)
tree9853986efefaefc811a91deb0de3775af6c386ce /libglusterfs
parent06fa5aff8de34a13db0e054800578cf8a45df152 (diff)
make posix return errors when gfid2path key is absent
Change-Id: I3a8d452d00560dac5e0b7ff0b1835d1f20a59f91 updates: bz#1580540 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> (cherry picked from commit c2cf3f686f3ea0efd936d2eafc404fc9d2e0acc7)
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;