From cb76cadb74a36e220a2b6a886c0c8068abdad0c7 Mon Sep 17 00:00:00 2001 From: "Anand V. Avati" Date: Fri, 16 Oct 2009 07:30:23 +0000 Subject: distribute,nufa: layout handling changes changes to make revalidate not fail but instead perform fresh lookup and swap inode context (layout) safely 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-helper.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'xlators/cluster/dht/src/dht-helper.c') diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c index 3ef528ff2..1b49046ce 100644 --- a/xlators/cluster/dht/src/dht-helper.c +++ b/xlators/cluster/dht/src/dht-helper.c @@ -108,7 +108,7 @@ dht_deitransform (xlator_t *this, uint64_t y, xlator_t **subvol_p, void -dht_local_wipe (dht_local_t *local) +dht_local_wipe (xlator_t *this, dht_local_t *local) { if (!local) return; @@ -122,8 +122,10 @@ dht_local_wipe (dht_local_t *local) if (local->inode) inode_unref (local->inode); - if (local->layout) - FREE (local->layout); + if (local->layout) { + dht_layout_unref (this, local->layout); + local->layout = NULL; + } loc_wipe (&local->linkfile.loc); @@ -141,6 +143,11 @@ dht_local_wipe (dht_local_t *local) if (local->xattr_req) dict_unref (local->xattr_req); + if (local->selfheal.layout) { + dht_layout_unref (this, local->selfheal.layout); + local->selfheal.layout = NULL; + } + FREE (local); } @@ -230,6 +237,10 @@ dht_subvol_get_hashed (xlator_t *this, loc_t *loc) } out: + if (layout) { + dht_layout_unref (this, layout); + } + return subvol; } @@ -250,6 +261,10 @@ dht_subvol_get_cached (xlator_t *this, inode_t *inode) subvol = layout->list[0].xlator; out: + if (layout) { + dht_layout_unref (this, layout); + } + return subvol; } -- cgit