diff options
author | Mohit Agrawal <moagrawal@redhat.com> | 2019-10-28 21:53:01 +0530 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2019-11-18 01:14:18 +0000 |
commit | cd1872ae49d7bc83403fce6821c102edc4e97796 (patch) | |
tree | 0d662f26ab042cdfbad0bf6051cbe70777cf2863 /xlators/storage/posix/src/posix-entry-ops.c | |
parent | 515d1b4577d989fa99f236d9e344a71db7d001a0 (diff) |
posix: Improve MAKE_HANDLE_PATH
Pass the maximum buffer (PATH_MAX) to posix_handle_path to
avoid the posix_handle_path call again.
Change-Id: I7d18313870218dc028c5f7fc94d6ec85a2bdb332
Updates #761
Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
Diffstat (limited to 'xlators/storage/posix/src/posix-entry-ops.c')
-rw-r--r-- | xlators/storage/posix/src/posix-entry-ops.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/xlators/storage/posix/src/posix-entry-ops.c b/xlators/storage/posix/src/posix-entry-ops.c index 795a8d6a043..4d83c094b98 100644 --- a/xlators/storage/posix/src/posix-entry-ops.c +++ b/xlators/storage/posix/src/posix-entry-ops.c @@ -645,12 +645,13 @@ posix_mkdir(call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, if (!gf_uuid_is_null(uuid_req)) { op_ret = posix_istat(this, loc->inode, uuid_req, NULL, &stbuf); if ((op_ret == 0) && IA_ISDIR(stbuf.ia_type)) { - size = posix_handle_path(this, uuid_req, NULL, NULL, 0); - if (size > 0) - gfid_path = alloca(size); - - if (gfid_path) - posix_handle_path(this, uuid_req, NULL, gfid_path, size); + gfid_path = alloca(PATH_MAX); + size = posix_handle_path(this, uuid_req, NULL, gfid_path, PATH_MAX); + if (size <= 0) { + op_errno = ESTALE; + op_ret = -1; + goto out; + } if (frame->root->pid != GF_CLIENT_PID_SELF_HEALD) { gf_msg(this->name, GF_LOG_WARNING, 0, P_MSG_DIR_OF_SAME_ID, |