From ff38298144730c95627cfc11416baa6b75d3c94d Mon Sep 17 00:00:00 2001 From: "Anand V. Avati" Date: Fri, 16 Oct 2009 07:30:24 +0000 Subject: distribute - more NULL check Signed-off-by: Anand V. Avati BUG: 315 (generation number support) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=315 --- xlators/cluster/dht/src/dht-common.c | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'xlators/cluster') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 62b864ac9ff..959e96ee9da 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -701,7 +701,8 @@ dht_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dht_itransform (this, prev->this, stbuf->st_ino, &stbuf->st_ino); - postparent->st_ino = loc->parent->ino; + if (loc->parent) + postparent->st_ino = loc->parent->ino; ret = dht_layout_preset (this, prev->this, inode); if (ret < 0) { @@ -2426,6 +2427,14 @@ dht_mknod (call_frame_t *frame, xlator_t *this, dht_get_du_info (frame, this, loc); + local = dht_local_init (frame); + if (!local) { + op_errno = ENOMEM; + gf_log (this->name, GF_LOG_ERROR, + "Out of memory"); + goto err; + } + subvol = dht_subvol_get_hashed (this, loc); if (!subvol) { gf_log (this->name, GF_LOG_DEBUG, @@ -2488,14 +2497,23 @@ int dht_symlink (call_frame_t *frame, xlator_t *this, const char *linkname, loc_t *loc) { - xlator_t *subvol = NULL; - int op_errno = -1; + xlator_t *subvol = NULL; + int op_errno = -1; + dht_local_t *local = NULL; VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (this, err); VALIDATE_OR_GOTO (loc, err); + local = dht_local_init (frame); + if (!local) { + op_errno = ENOMEM; + gf_log (this->name, GF_LOG_ERROR, + "Out of memory"); + goto err; + } + subvol = dht_subvol_get_hashed (this, loc); if (!subvol) { gf_log (this->name, GF_LOG_DEBUG, -- cgit