summaryrefslogtreecommitdiffstats
path: root/api
diff options
context:
space:
mode:
authorRajesh Joseph <rjoseph@redhat.com>2015-02-17 06:55:22 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2015-02-20 08:04:47 -0800
commit2b821b114836901bf1e661fc6c4e212298c9768d (patch)
treeafa60f8a2a864a03ff245828c4069a5cca7e2d68 /api
parentdf9f1cd96854c82338c62897d788319b560e43ad (diff)
gfapi: handle inode_link failures gracefully
Bug: 1193757 Change-Id: I73bfb91a6a73ad4f06e8828d2d7efd34d9873888 Signed-off-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-on: http://review.gluster.org/9671 Reviewed-by: Niels de Vos <ndevos@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'api')
-rw-r--r--api/src/glfs-resolve.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/api/src/glfs-resolve.c b/api/src/glfs-resolve.c
index 5efe91b8d5b..9aeac57b75e 100644
--- a/api/src/glfs-resolve.c
+++ b/api/src/glfs-resolve.c
@@ -402,8 +402,10 @@ priv_glfs_resolve_at (struct glfs *fs, xlator_t *subvol, inode_t *at,
*/
(reval || (!next_component &&
iatt)));
- if (!inode)
+ if (!inode) {
+ ret = -1;
break;
+ }
if (IA_ISLNK (ciatt.ia_type) && (next_component || follow)) {
/* If the component is not the last piece,
@@ -509,12 +511,18 @@ glfs_resolve_path (struct glfs *fs, xlator_t *subvol, const char *origpath,
iatt, follow, reval);
cwd = glfs_cwd_get (fs);
+ if (NULL == cwd) {
+ gf_log (subvol->name, GF_LOG_WARNING, "Failed to get cwd");
+ errno = EIO;
+ goto out;
+ }
ret = priv_glfs_resolve_at (fs, subvol, cwd, origpath, loc, iatt,
follow, reval);
if (cwd)
inode_unref (cwd);
+out:
return ret;
}