From e7a8ba1eaf5ee55bc0a63d97992e9adc1a87889e Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Tue, 31 May 2011 00:52:01 +0000 Subject: pump: Detect 'empty' brick and finish migration. Signed-off-by: Krishnan Parthasarathi BUG: 2909 (replace brick of empty brick never says migration completed) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2909 Signed-off-by: Anand Avati BUG: 2909 (replace brick of empty brick never says migration completed) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2909 --- xlators/cluster/afr/src/pump.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c index c63011c81..4bffbd9de 100644 --- a/xlators/cluster/afr/src/pump.c +++ b/xlators/cluster/afr/src/pump.c @@ -419,6 +419,7 @@ gf_pump_traverse_directory (loc_t *loc) char *file_path = NULL; int ret = 0; + gf_boolean_t is_directory_empty = _gf_true; INIT_LIST_HEAD (&entries.list); this = THIS; @@ -468,6 +469,7 @@ gf_pump_traverse_directory (loc_t *loc) if (!IS_ENTRY_CWD (entry->d_name) && !IS_ENTRY_PARENT (entry->d_name)) { + is_directory_empty = _gf_false; ret = syncop_lookup (this, &entry_loc, NULL, &iatt, &xattr_rsp, &parent); @@ -526,6 +528,12 @@ gf_pump_traverse_directory (loc_t *loc) } + if (is_directory_empty && IS_ROOT_PATH (loc->path)) { + pump_change_state (this, PUMP_STATE_RUNNING); + gf_log (this->name, GF_LOG_INFO, "Empty source brick. " + "Nothing to be done."); + } + out: return 0; -- cgit