From 1eb3fd72b13353fdb93dd0773d9da7aafccdde6b Mon Sep 17 00:00:00 2001 From: Vikas Gorur Date: Thu, 3 Sep 2009 09:44:34 +0000 Subject: cluster/afr: Do not try to self-heal "/" If the root directory does not exist on a subvolume, don't try to create it. Signed-off-by: Anand V. Avati BUG: 28 (Deleting a backend export directory in an AFR setup can cause a segfault while trying to self heal) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=28 --- xlators/cluster/afr/src/afr-self-heal-common.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'xlators/cluster') diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c index 99e6503ac3a..38fe1e6e7f3 100644 --- a/xlators/cluster/afr/src/afr-self-heal-common.c +++ b/xlators/cluster/afr/src/afr-self-heal-common.c @@ -980,14 +980,22 @@ sh_missing_entries_mkdir (call_frame_t *frame, xlator_t *this) for (i = 0; i < priv->child_count; i++) { if (sh->child_errno[i] == ENOENT) { - STACK_WIND_COOKIE (frame, - sh_missing_entries_newentry_cbk, - (void *) (long) i, - priv->children[i], - priv->children[i]->fops->mkdir, - &local->loc, st_mode); - if (!--call_count) - break; + if (!strcmp (local->loc.path, "/")) { + /* We shouldn't try to create "/" */ + + sh_missing_entries_finish (frame, this); + + return 0; + } else { + STACK_WIND_COOKIE (frame, + sh_missing_entries_newentry_cbk, + (void *) (long) i, + priv->children[i], + priv->children[i]->fops->mkdir, + &local->loc, st_mode); + if (!--call_count) + break; + } } } -- cgit