summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2012-07-29 20:22:07 +0530
committerAnand Avati <avati@redhat.com>2012-07-31 11:25:39 -0700
commitb21395aee3b5676f94231165f492f776133ff507 (patch)
treef6958839c69effc5e13e9bbb247a3d2ff2fcda13 /xlators/cluster/afr/src
parent7e892ac95a4dd4c38ca793ef1b987cd24758ec4d (diff)
cluster/afr: update loc inode after inode_link
RCA: inode passed to inode_link is not assigned any gfid if the inode with that gfid is already linked, so loc for opendir does not have a valid inode Fix: Use the linked_inode returned by inode_link in the loc to perform further operations on the entry. Tests: Checked that opendir comes with an loc with valid inode. Checked that re-opendir happens successfully. Tested index, full self-heal work fine with the fix. Change-Id: Idf4ced4cc2320133744962059d363e373af0e5ec BUG: 826580 Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Reviewed-on: http://review.gluster.com/3748 Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src')
-rw-r--r--xlators/cluster/afr/src/afr-self-heald.c36
1 files changed, 24 insertions, 12 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c
index 6184036b278..f87e5734422 100644
--- a/xlators/cluster/afr/src/afr-self-heald.c
+++ b/xlators/cluster/afr/src/afr-self-heald.c
@@ -698,6 +698,25 @@ out:
}
int
+_link_inode_update_loc (xlator_t *this, loc_t *loc, struct iatt *iattr)
+{
+ inode_t *link_inode = NULL;
+ int ret = -1;
+
+ link_inode = inode_link (loc->inode, NULL, NULL, iattr);
+ if (link_inode == NULL) {
+ gf_log (this->name, GF_LOG_ERROR, "inode link failed "
+ "on the inode (%s)", uuid_utoa (iattr->ia_gfid));
+ goto out;
+ }
+ inode_unref (loc->inode);
+ loc->inode = link_inode;
+ ret = 0;
+out:
+ return ret;
+}
+
+int
afr_local_pathinfo (char *pathinfo, gf_boolean_t *local)
{
int ret = 0;
@@ -738,7 +757,6 @@ afr_crawl_build_start_loc (xlator_t *this, afr_crawl_data_t *crawl_data,
struct iatt parent = {0};
int ret = 0;
xlator_t *readdir_xl = crawl_data->readdir_xl;
- inode_t *link_inode = NULL;
priv = this->private;
if (crawl_data->crawl == FULL) {
@@ -774,8 +792,9 @@ afr_crawl_build_start_loc (xlator_t *this, afr_crawl_data_t *crawl_data,
}
goto out;
}
- link_inode = inode_link (dirloc->inode, NULL, NULL, &iattr);
- inode_unref (link_inode);
+ ret = _link_inode_update_loc (this, dirloc, &iattr);
+ if (ret)
+ goto out;
}
ret = 0;
out:
@@ -861,7 +880,6 @@ _process_entries (xlator_t *this, loc_t *parentloc, gf_dirent_t *entries,
loc_t entry_loc = {0};
fd_t *fd = NULL;
struct iatt iattr = {0};
- inode_t *link_inode = NULL;
list_for_each_entry_safe (entry, tmp, &entries->list, list) {
if (!_crawl_proceed (this, crawl_data->child,
@@ -893,15 +911,9 @@ _process_entries (xlator_t *this, loc_t *parentloc, gf_dirent_t *entries,
if (ret)
continue;
- link_inode = inode_link (entry_loc.inode, NULL, NULL, &iattr);
- if (link_inode == NULL) {
- gf_log (this->name, GF_LOG_ERROR, "inode link failed "
- "on the inode (%s)",entry_loc.path);
- ret = -1;
+ ret = _link_inode_update_loc (this, &entry_loc, &iattr);
+ if (ret)
goto out;
- }
- inode_unref (link_inode);
-
if (crawl_data->crawl == INDEX)
continue;