3604df
From 9f8b8df58d65fcefbe858d39328f4a9db7d4ebf6 Mon Sep 17 00:00:00 2001
3604df
From: Ashish Pandey <aspandey@redhat.com>
3604df
Date: Tue, 20 Dec 2016 16:09:10 +0530
3604df
Subject: [PATCH 251/257] storage/posix: Do not create a directory which
3604df
 already exist
3604df
3604df
Problem: While brick process starts, it tries to create trashcan
3604df
and internal_op directory with fixed gfids. For the first time
3604df
these directories will not be present. However, stop and start
3604df
of volume again tries to create these directories, which are
3604df
already present.
3604df
This throws a gfid exist warning and EEXIST error in logs.
3604df
3604df
Solution: Check if the directory exist on brick and gfid of
3604df
this dir and the requested gfid matches or not.
3604df
3604df
>Change-Id: Ie4966a550ed44046e0f2d10e9dbd540182ea97d2
3604df
>BUG: 1406348
3604df
>Signed-off-by: Ashish Pandey <aspandey@redhat.com>
3604df
>Reviewed-on: http://review.gluster.org/16212
3604df
>Smoke: Gluster Build System <jenkins@build.gluster.org>
3604df
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
3604df
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
3604df
>Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
3604df
>Signed-off-by: Ashish Pandey <aspandey@redhat.com>
3604df
3604df
Change-Id: Ie4966a550ed44046e0f2d10e9dbd540182ea97d2
3604df
BUG: 1404110
3604df
Signed-off-by: Ashish Pandey <aspandey@redhat.com>
3604df
Reviewed-on: https://code.engineering.redhat.com/gerrit/93559
3604df
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
3604df
Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
3604df
---
3604df
 xlators/storage/posix/src/posix.c | 9 ++++++++-
3604df
 1 file changed, 8 insertions(+), 1 deletion(-)
3604df
3604df
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
3604df
index 2d9e3f6..266cd5d 100644
3604df
--- a/xlators/storage/posix/src/posix.c
3604df
+++ b/xlators/storage/posix/src/posix.c
3604df
@@ -1465,8 +1465,15 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
3604df
 
3604df
         SET_FS_ID (frame->root->uid, gid);
3604df
 
3604df
-        if (xdata)
3604df
+        if (xdata) {
3604df
                 op_ret = dict_get_ptr (xdata, "gfid-req", &uuid_req);
3604df
+                if (!op_ret && !gf_uuid_compare (stbuf.ia_gfid, uuid_req)) {
3604df
+                        op_ret = -1;
3604df
+                        op_errno = EEXIST;
3604df
+                        goto out;
3604df
+                }
3604df
+        }
3604df
+
3604df
         if (uuid_req && !gf_uuid_is_null (uuid_req)) {
3604df
                 op_ret = posix_istat (this, uuid_req, NULL, &stbuf);
3604df
                 if ((op_ret == 0) && IA_ISDIR (stbuf.ia_type)) {
3604df
-- 
3604df
2.9.3
3604df