diff options
| -rw-r--r-- | xlators/cluster/dht/src/dht-layout.c | 10 | ||||
| -rw-r--r-- | xlators/cluster/dht/src/dht-rename.c | 4 | ||||
| -rw-r--r-- | xlators/cluster/dht/src/dht-shared.c | 8 | 
3 files changed, 12 insertions, 10 deletions
diff --git a/xlators/cluster/dht/src/dht-layout.c b/xlators/cluster/dht/src/dht-layout.c index bbac904743e..2ed15c5e43c 100644 --- a/xlators/cluster/dht/src/dht-layout.c +++ b/xlators/cluster/dht/src/dht-layout.c @@ -69,6 +69,7 @@ dht_layout_get (xlator_t *this, inode_t *inode)  {          dht_conf_t   *conf = NULL;          dht_layout_t *layout = NULL; +        int           ret = 0;          conf = this->private;          if (!conf) @@ -76,8 +77,8 @@ dht_layout_get (xlator_t *this, inode_t *inode)          LOCK (&conf->layout_lock);          { -                dht_inode_ctx_layout_get (inode, this, &layout); -                if (layout) { +                ret = dht_inode_ctx_layout_get (inode, this, &layout); +                if ((!ret) && layout) {                          layout->ref++;                  }          } @@ -97,13 +98,14 @@ dht_layout_set (xlator_t *this, inode_t *inode, dht_layout_t *layout)          dht_layout_t *old_layout;          conf = this->private; -        if (!conf) +        if (!conf || !layout)                  goto out;          LOCK (&conf->layout_lock);          {                  oldret = dht_inode_ctx_layout_get (inode, this, &old_layout); -                layout->ref++; +                if (layout) +                        layout->ref++;                  dht_inode_ctx_layout_set (inode, this, layout);          }          UNLOCK (&conf->layout_lock); diff --git a/xlators/cluster/dht/src/dht-rename.c b/xlators/cluster/dht/src/dht-rename.c index 7d73eb9f272..0594945203e 100644 --- a/xlators/cluster/dht/src/dht-rename.c +++ b/xlators/cluster/dht/src/dht-rename.c @@ -792,16 +792,12 @@ unwind:          WIPE (&local->postoldparent);          WIPE (&local->preparent);          WIPE (&local->postparent); -        if (xattr) -                dict_unref (xattr);          dht_rename_done (frame, this);          return 0;  cleanup: -        if (xattr) -                dict_unref (xattr);          dht_rename_cleanup (frame);          return 0; diff --git a/xlators/cluster/dht/src/dht-shared.c b/xlators/cluster/dht/src/dht-shared.c index 0c008d83653..fc281b80287 100644 --- a/xlators/cluster/dht/src/dht-shared.c +++ b/xlators/cluster/dht/src/dht-shared.c @@ -594,8 +594,12 @@ dht_init (xlator_t *this)          conf->search_unhashed = GF_DHT_LOOKUP_UNHASHED_ON;          if (dict_get_str (this->options, "lookup-unhashed", &temp_str) == 0) {                  /* If option is not "auto", other options _should_ be boolean */ -                if (strcasecmp (temp_str, "auto")) -                        gf_string2boolean (temp_str, &conf->search_unhashed); +                if (strcasecmp (temp_str, "auto")) { +                        ret = gf_string2boolean (temp_str, +                                                 &conf->search_unhashed); +                        if (ret == -1) +                                goto err; +                }                  else                          conf->search_unhashed = GF_DHT_LOOKUP_UNHASHED_AUTO;          }  | 
