summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht/src/dht-helper.c
diff options
context:
space:
mode:
authorShehjar Tikoo <shehjart@gluster.com>2010-02-25 15:38:03 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-03-04 03:13:13 -0800
commit0a86bd1aa3004a9f27e59eb08f8facf312234737 (patch)
treea0df26d4e37e72dcbb9d42cca860ab554ea10821 /xlators/cluster/dht/src/dht-helper.c
parent59947fc4c28a0310d76a663d2440c08b762ed3fd (diff)
distribute: Respect end-of-dir on readdir only for last subvol
We need to ensure that only the last subvolume's end-of-directory notification is respected so that directory reading does not stop before all subvolumes have been read. That could happen because the posix for each subvolume sends a ENOENT on end-of-directory but in distribute we're not concerned only with a posix's view of the directory but the aggregated namespace' view of the directory, which is maintained by distribute. Signed-off-by: Shehjar Tikoo <shehjart@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 597 (miscellaneous fixes for xlators to work well with NFS xlator) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=597
Diffstat (limited to 'xlators/cluster/dht/src/dht-helper.c')
-rw-r--r--xlators/cluster/dht/src/dht-helper.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-helper.c b/xlators/cluster/dht/src/dht-helper.c
index 5a89ba58489..ebc0e5e014a 100644
--- a/xlators/cluster/dht/src/dht-helper.c
+++ b/xlators/cluster/dht/src/dht-helper.c
@@ -208,6 +208,27 @@ dht_first_up_subvol (xlator_t *this)
return child;
}
+xlator_t *
+dht_last_up_subvol (xlator_t *this)
+{
+ dht_conf_t *conf = NULL;
+ xlator_t *child = NULL;
+ int i = 0;
+
+ conf = this->private;
+ LOCK (&conf->subvolume_lock);
+ {
+ for (i = conf->subvolume_cnt-1; i >= 0; i--) {
+ if (conf->subvolume_status[i]) {
+ child = conf->subvolumes[i];
+ break;
+ }
+ }
+ }
+ UNLOCK (&conf->subvolume_lock);
+
+ return child;
+}
xlator_t *
dht_subvol_get_hashed (xlator_t *this, loc_t *loc)