Blob Blame History Raw
From e56605d5808b41335026a5470fa10f5e5b5389f3 Mon Sep 17 00:00:00 2001
From: Mohit Agrawal <moagrawal@redhat.com>
Date: Mon, 6 Apr 2020 21:58:03 +0530
Subject: [PATCH 560/584] posix: Avoid dict_del logs in posix_is_layout_stale
 while key is NULL

Problem: The key "GF_PREOP_PARENT_KEY" has been populated by dht and
         for non-distribute volume like 1x3 key is not populated so
         posix_is_layout stale throw a message while a file is created

Solution: To avoid a log put a condition before delete a key

Upstream patch details:
> https://review.gluster.org/#/c/glusterfs/+/24297/
> Change-Id: I813ee7960633e7f9f5e9ad2f42f288053d9eb71f
> Fixes: #1150
> Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>

BUG: 1942816
Change-Id: I746a2619989265f3bc9bb648c4b8e4bbefaedc56
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/c/rhs-glusterfs/+/244925
Tested-by: RHGS Build Bot <nigelb@redhat.com>
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
---
 tests/bugs/glusterd/brick-mux-validation.t | 4 ++--
 xlators/storage/posix/src/posix-helpers.c  | 5 +++--
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/tests/bugs/glusterd/brick-mux-validation.t b/tests/bugs/glusterd/brick-mux-validation.t
index 03a4768..61b0455 100644
--- a/tests/bugs/glusterd/brick-mux-validation.t
+++ b/tests/bugs/glusterd/brick-mux-validation.t
@@ -24,7 +24,7 @@ TEST $CLI volume create $V0 $H0:$B0/${V0}{1..3}
 TEST $CLI volume start $V0
 
 EXPECT 1 count_brick_processes
-EXPECT 1 count_brick_pids
+EXPECT_WITHIN $PROCESS_UP_TIMEOUT 1 count_brick_pids
 EXPECT_WITHIN $PROCESS_UP_TIMEOUT 3 online_brick_count
 
 pkill gluster
@@ -101,4 +101,4 @@ TEST $CLI_IGNORE_PARTITION volume reset-brick $V1 $H0:$B0/${V1}1 $H0:$B0/${V1}1
 EXPECT_WITHIN $PROCESS_UP_TIMEOUT 6 online_brick_count
 EXPECT 1 count_brick_processes
 
-cleanup;
\ No newline at end of file
+cleanup;
diff --git a/xlators/storage/posix/src/posix-helpers.c b/xlators/storage/posix/src/posix-helpers.c
index 110d383..16351d8 100644
--- a/xlators/storage/posix/src/posix-helpers.c
+++ b/xlators/storage/posix/src/posix-helpers.c
@@ -3596,13 +3596,14 @@ posix_is_layout_stale(dict_t *xdata, char *par_path, xlator_t *this)
     op_ret = dict_get_str_sizen(xdata, GF_PREOP_PARENT_KEY, &xattr_name);
     if (xattr_name == NULL) {
         op_ret = 0;
-        goto out;
+        return is_stale;
     }
 
     arg_data = dict_get(xdata, xattr_name);
     if (!arg_data) {
         op_ret = 0;
-        goto out;
+        dict_del_sizen(xdata, GF_PREOP_PARENT_KEY);
+        return is_stale;
     }
 
     size = sys_lgetxattr(par_path, xattr_name, value_buf,
-- 
1.8.3.1