diff options
author | Amar Tumballi <amar@gluster.com> | 2011-09-26 17:42:40 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2011-09-27 05:37:59 -0700 |
commit | ea71efe027e9f741032b6bf9dd995bcaa2fa7947 (patch) | |
tree | 0cc90449ee5bb0331b52da83c6f99b31587fe9cf | |
parent | 0286dd866a89c035073294c348a43beca3109c38 (diff) |
cluster/distribute: fixed a spurious inode ref
While bringing in support to open-fd migration, dht_local_init()
itself started doing 'loc_copy()'. I had left one case in dht_lookup()
where there is a extra loc_copy() on existing copied 'local->loc',
which would cause 2 inode_refs on a given inode, and only one
inode_unref() happens in dht_local_wipe().
Change-Id: Idd0375bdf9a6408db1e97e80389249ef8d802adb
BUG: 3590
Reviewed-on: http://review.gluster.com/504
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Shishir Gowda <shishirng@gluster.com>
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 5c582555683..671a9b2094f 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -1039,7 +1039,7 @@ dht_lookup (call_frame_t *frame, xlator_t *this, dht_layout_t *layout = NULL; int i = 0; int call_cnt = 0; - + loc_t new_loc = {0,}; VALIDATE_OR_GOTO (frame, err); VALIDATE_OR_GOTO (this, err); @@ -1056,9 +1056,17 @@ dht_lookup (call_frame_t *frame, xlator_t *this, op_errno = ENOMEM; goto err; } - if (!dht_filter_loc_subvol_key (this, loc, &local->loc, - &hashed_subvol)) { - ret = loc_dup (loc, &local->loc); + + ret = dht_filter_loc_subvol_key (this, loc, &new_loc, + &hashed_subvol); + if (ret) { + loc_wipe (&local->loc); + ret = loc_dup (&new_loc, &local->loc); + + /* we no more need 'new_loc' entries */ + loc_wipe (&new_loc); + + /* check if loc_dup() is successful */ if (ret == -1) { op_errno = errno; gf_log (this->name, GF_LOG_DEBUG, |