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/cluster/afr/src/afr-dir-write.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'xlators/cluster/afr') diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c index b6b81d737b0..457cc988874 100644 --- a/xlators/cluster/afr/src/afr-dir-write.c +++ b/xlators/cluster/afr/src/afr-dir-write.c @@ -732,13 +732,19 @@ afr_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, local->cont.mkdir.mode = mode; local->umask = umask; - if (xdata) - local->xdata_req = dict_copy_with_ref (xdata, NULL); - else - local->xdata_req = dict_new (); + if (!xdata || !dict_get (xdata, "gfid-req")) { + op_errno = EPERM; + gf_msg_callingfn (this->name, GF_LOG_WARNING, op_errno, + AFR_MSG_GFID_NULL, "mkdir: %s is received " + "without gfid-req %p", loc->path, xdata); + goto out; + } - if (!local->xdata_req) - goto out; + local->xdata_req = dict_copy_with_ref (xdata, NULL); + if (!local->xdata_req) { + op_errno = ENOMEM; + goto out; + } local->op = GF_FOP_MKDIR; local->transaction.wind = afr_mkdir_wind; -- cgit