From b246b07896fefb261c9fb07f3f29f0d03b81b88d Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Mon, 14 Mar 2016 10:59:38 +0530 Subject: dht/afr/client/posix: Fail mkdir without gfid-req Do not allow directory creations without gfids as after the directories are created, operations on them fail anyway. So it is better to fail mkdir. BUG: 1317361 Change-Id: I8f8e3b38bbded1960b7215bac0432500f7e78038 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/13690 Smoke: Gluster Build System Reviewed-by: Krutika Dhananjay CentOS-regression: Gluster Build System NetBSD-regression: NetBSD Build System --- xlators/storage/posix/src/posix.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'xlators/storage') diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c index 4f286fda333..b823257d540 100644 --- a/xlators/storage/posix/src/posix.c +++ b/xlators/storage/posix/src/posix.c @@ -1449,7 +1449,8 @@ posix_mkdir (call_frame_t *frame, xlator_t *this, SET_FS_ID (frame->root->uid, gid); - op_ret = dict_get_ptr (xdata, "gfid-req", &uuid_req); + if (xdata) + op_ret = dict_get_ptr (xdata, "gfid-req", &uuid_req); 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)) { @@ -1470,6 +1471,13 @@ posix_mkdir (call_frame_t *frame, xlator_t *this, loc->path, uuid_utoa (uuid_req), gfid_path ? gfid_path : ""); } + } else if (!uuid_req && frame->root->pid != GF_SERVER_PID_TRASH) { + op_ret = -1; + op_errno = EPERM; + gf_msg_callingfn (this->name, GF_LOG_WARNING, op_errno, + P_MSG_NULL_GFID, "mkdir (%s): is issued without " + "gfid-req %p", loc->path, xdata); + goto out; } op_ret = posix_pstat (this, loc->pargfid, par_path, &preparent); -- cgit