21ab4e
From 7f9048b753df3e8176ce999d9695e87242b34366 Mon Sep 17 00:00:00 2001
21ab4e
From: Mohit Agrawal <moagrawa@redhat.com>
21ab4e
Date: Thu, 8 Jun 2017 13:04:42 +0530
21ab4e
Subject: [PATCH 495/509] glusterfsd: Deletion of brick dir throw emerg msgs
21ab4e
 after stop volume
21ab4e
21ab4e
Problem: Deletion of brick directories throw emerg messages after stop
21ab4e
         volume while brick mux is enabled.
21ab4e
21ab4e
Solution: Modify the posix health check monitor thread code to
21ab4e
          handled correctly.
21ab4e
21ab4e
> BUG: 1459781
21ab4e
> Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
21ab4e
> Change-Id: I2d22a84f9a98b0da261e5fb7850ba1368f3601d7
21ab4e
> Reviewed-on: https://review.gluster.org/17492
21ab4e
> Tested-by: MOHIT AGRAWAL <moagrawa@redhat.com>
21ab4e
> Smoke: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
21ab4e
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
21ab4e
> Reviewed-by: Raghavendra Talur <rtalur@redhat.com>
21ab4e
> Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
21ab4e
> (cherry picked from commit 5b82f173ba337b2fe06846c2a0e5f35d1ff53357)
21ab4e
21ab4e
BUG: 1451602
21ab4e
Change-Id: Iaad3a6a935803f99bf77d6ba6db4b5bb1b187c22
21ab4e
Signed-off-by: Mohit Agrawal <moagrawa@redhat.com>
21ab4e
Reviewed-on: https://code.engineering.redhat.com/gerrit/108719
21ab4e
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
21ab4e
---
21ab4e
 xlators/features/changetimerecorder/src/changetimerecorder.c | 4 ++--
21ab4e
 xlators/storage/posix/src/posix-helpers.c                    | 6 +++---
21ab4e
 xlators/storage/posix/src/posix.c                            | 1 +
21ab4e
 3 files changed, 6 insertions(+), 5 deletions(-)
21ab4e
21ab4e
diff --git a/xlators/features/changetimerecorder/src/changetimerecorder.c b/xlators/features/changetimerecorder/src/changetimerecorder.c
21ab4e
index ac2406f..6ce68d6 100644
21ab4e
--- a/xlators/features/changetimerecorder/src/changetimerecorder.c
21ab4e
+++ b/xlators/features/changetimerecorder/src/changetimerecorder.c
21ab4e
@@ -2180,9 +2180,9 @@ notify (xlator_t *this, int event, void *data, ...)
21ab4e
                                 CTR_MSG_CLOSE_DB_CONN_FAILED, "Failed closing "
21ab4e
                                 "db connection");
21ab4e
                 }
21ab4e
-        } else  {
21ab4e
-                ret = default_notify (this, event, data);
21ab4e
         }
21ab4e
+        ret = default_notify (this, event, data);
21ab4e
+
21ab4e
 out:
21ab4e
         return ret;
21ab4e
 
21ab4e
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
21ab4e
index 411d0ba..b5961db 100644
21ab4e
--- a/xlators/storage/posix/src/posix-helpers.c
21ab4e
+++ b/xlators/storage/posix/src/posix-helpers.c
21ab4e
@@ -1876,15 +1876,15 @@ posix_health_check_thread_proc (void *data)
21ab4e
                 ret = sleep (interval);
21ab4e
                 if (ret > 0)
21ab4e
                         break;
21ab4e
-
21ab4e
                 /* prevent thread errors while doing the health-check(s) */
21ab4e
                 pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL);
21ab4e
 
21ab4e
                 /* Do the health-check.*/
21ab4e
                 ret = posix_fs_health_check (this);
21ab4e
-                if (ret < 0)
21ab4e
+                if (ret < 0 && priv->health_check_active)
21ab4e
                         goto abort;
21ab4e
-
21ab4e
+                if (!priv->health_check_active)
21ab4e
+                        goto out;
21ab4e
                 pthread_setcancelstate (PTHREAD_CANCEL_ENABLE, NULL);
21ab4e
         }
21ab4e
 
21ab4e
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
21ab4e
index 7bd0dc5..0524d50 100644
21ab4e
--- a/xlators/storage/posix/src/posix.c
21ab4e
+++ b/xlators/storage/posix/src/posix.c
21ab4e
@@ -6599,6 +6599,7 @@ notify (xlator_t *this,
21ab4e
         break;
21ab4e
         case GF_EVENT_CLEANUP:
21ab4e
                 if (priv->health_check) {
21ab4e
+                        priv->health_check_active = _gf_false;
21ab4e
                         pthread_cancel (priv->health_check);
21ab4e
                         priv->health_check = 0;
21ab4e
                 }
21ab4e
-- 
21ab4e
1.8.3.1
21ab4e