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>
This commit is contained in:
Rajesh Joseph 2015-02-17 06:55:22 +05:30 committed by Krishnan Parthasarathi
parent df9f1cd968
commit 2b821b1148

View File

@ -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;
}