From 2b821b114836901bf1e661fc6c4e212298c9768d Mon Sep 17 00:00:00 2001 From: Rajesh Joseph Date: Tue, 17 Feb 2015 06:55:22 +0530 Subject: gfapi: handle inode_link failures gracefully Bug: 1193757 Change-Id: I73bfb91a6a73ad4f06e8828d2d7efd34d9873888 Signed-off-by: Rajesh Joseph Reviewed-on: http://review.gluster.org/9671 Reviewed-by: Niels de Vos Tested-by: Gluster Build System Reviewed-by: Krishnan Parthasarathi Tested-by: Krishnan Parthasarathi --- api/src/glfs-resolve.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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; } -- cgit