diff options
author | Raghavendra Bhat <raghavendrabhat@gluster.com> | 2012-03-08 01:26:29 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-03-14 03:53:35 -0700 |
commit | a059bc30561a3046e255ba1e6ad54b09f0b03636 (patch) | |
tree | 7c6850c2199a9d3e8f651110035eef644896aff1 | |
parent | f9be1e7c665be0507e431cb42cd55032807bd3ea (diff) |
cluster/afr: handle sending NULL dentry name for inode link in self-heal-daemon
* Without the dentry name, dentry cannot be created in inode_link, which
leads to trying to access the null dentry to check if it is cyclic and
thus segfault. So send the parent inode also NULL, which just returns
the proper inode after assigning the gfid and type to the inode without
trying to create dentry.
* Handle failures such as dentry_create returning NULL, in inode_link
properly and return NULL in such cases.
* Increase the lru limit of inode table of self-heal-daemon to 2048
Change-Id: I7ae0e0e9be279d1694b6aafb5e054585e43f03ff
BUG: 801149
Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com>
Reviewed-on: http://review.gluster.com/2893
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Reviewed-by: Vijay Bellur <vijay@gluster.com>
-rw-r--r-- | libglusterfs/src/inode.c | 8 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heald.c | 11 | ||||
-rw-r--r-- | xlators/cluster/afr/src/afr.c | 2 |
3 files changed, 19 insertions, 2 deletions
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c index 3fad499ebcb..08bedf8fa3e 100644 --- a/libglusterfs/src/inode.c +++ b/libglusterfs/src/inode.c @@ -813,6 +813,14 @@ __inode_link (inode_t *inode, inode_t *parent, const char *name, if (!old_dentry || old_dentry->inode != link_inode) { dentry = __dentry_create (link_inode, parent, name); + if (!dentry) { + gf_log_callingfn (THIS->name, GF_LOG_ERROR, + "dentry create failed on " + "inode %s with parent %s", + uuid_utoa (link_inode->gfid), + uuid_utoa (parent->gfid)); + return NULL; + } if (old_inode && __is_dentry_cyclic (dentry)) { __dentry_unset (dentry); return NULL; diff --git a/xlators/cluster/afr/src/afr-self-heald.c b/xlators/cluster/afr/src/afr-self-heald.c index 36d2cfb6ee5..fde17209fe3 100644 --- a/xlators/cluster/afr/src/afr-self-heald.c +++ b/xlators/cluster/afr/src/afr-self-heald.c @@ -715,6 +715,7 @@ _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, @@ -751,7 +752,15 @@ _process_entries (xlator_t *this, loc_t *parentloc, gf_dirent_t *entries, if (ret || !IA_ISDIR (iattr.ia_type)) continue; - inode_link (entry_loc.inode, parentloc->inode, NULL, &iattr); + link_inode = inode_link (entry_loc.inode, NULL, NULL, &iattr); + if (link_inode == NULL) { + char uuidbuf[64]; + gf_log (this->name, GF_LOG_ERROR, "inode link failed " + "on the inode (%s)", + uuid_utoa_r (entry_loc.gfid, uuidbuf)); + ret = -1; + goto out; + } fd = NULL; ret = afr_crawl_opendir (this, crawl_data, &fd, &entry_loc); diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c index ce82aede839..0bd389ef90c 100644 --- a/xlators/cluster/afr/src/afr.c +++ b/xlators/cluster/afr/src/afr.c @@ -30,7 +30,7 @@ #endif #include "afr-common.c" -#define SHD_INODE_LRU_LIMIT 100 +#define SHD_INODE_LRU_LIMIT 2048 #define AFR_EH_HEALED_LIMIT 1024 #define AFR_EH_HEAL_FAIL_LIMIT 1024 #define AFR_EH_SPLIT_BRAIN_LIMIT 1024 |