summaryrefslogtreecommitdiffstats
path: root/xlators/storage/posix/src
diff options
context:
space:
mode:
authorAshish Pandey <aspandey@redhat.com>2016-12-20 16:09:10 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-12-21 21:41:03 -0800
commit97bfea234b1c097e7217181e7e6285fbd553d003 (patch)
tree50b133514bf94abb9fc320fe29ae223a8f9a743e /xlators/storage/posix/src
parentaf6769675acbbfd780fa2ece8587502d6d579372 (diff)
storage/posix: Do not create a directory which already exist
Problem: While brick process starts, it tries to create trashcan and internal_op directory with fixed gfids. For the first time these directories will not be present. However, stop and start of volume again tries to create these directories, which are already present. This throws a gfid exist warning and EEXIST error in logs. Solution: Check if the directory exist on brick and gfid of this dir and the requested gfid matches or not. Change-Id: Ie4966a550ed44046e0f2d10e9dbd540182ea97d2 BUG: 1406348 Signed-off-by: Ashish Pandey <aspandey@redhat.com> Reviewed-on: http://review.gluster.org/16212 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src')
-rw-r--r--xlators/storage/posix/src/posix.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index d7b175c9434..7abd2955fbb 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -1465,8 +1465,15 @@ posix_mkdir (call_frame_t *frame, xlator_t *this,
SET_FS_ID (frame->root->uid, gid);
- if (xdata)
+ if (xdata) {
op_ret = dict_get_ptr (xdata, "gfid-req", &uuid_req);
+ if (!op_ret && !gf_uuid_compare (stbuf.ia_gfid, uuid_req)) {
+ op_ret = -1;
+ op_errno = EEXIST;
+ goto out;
+ }
+ }
+
if (uuid_req && !gf_uuid_is_null (uuid_req)) {
op_ret = posix_istat (this, uuid_req, NULL, &stbuf);
if ((op_ret == 0) && IA_ISDIR (stbuf.ia_type)) {