diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2016-03-14 10:59:38 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2016-06-16 23:52:55 -0700 |
commit | 02e1ca67027e6fbbc9e854ac9def183745488022 (patch) | |
tree | 79a66180dc80f83633c908d0011615ba1987eaba /xlators/cluster | |
parent | 0fea541b0b217fc3c76e6a36577b99be71e32d56 (diff) |
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 <pkarampu@redhat.com>
>Reviewed-on: http://review.gluster.org/13690
>Smoke: Gluster Build System <jenkins@build.gluster.com>
>Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
>CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
>(cherry picked from commit b246b07896fefb261c9fb07f3f29f0d03b81b88d)
Change-Id: Ibf9c84add7265e3e1755a37958e1de38307624b2
BUG: 1332372
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/14188
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>
Diffstat (limited to 'xlators/cluster')
-rw-r--r-- | xlators/cluster/afr/src/afr-dir-write.c | 18 | ||||
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 8 |
2 files changed, 20 insertions, 6 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c index 921b73c295d..bd2427696a5 100644 --- a/xlators/cluster/afr/src/afr-dir-write.c +++ b/xlators/cluster/afr/src/afr-dir-write.c @@ -752,13 +752,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; diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 0cad65dee26..b40962ef690 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -7348,6 +7348,14 @@ dht_mkdir (call_frame_t *frame, xlator_t *this, conf = this->private; + if (!params || !dict_get (params, "gfid-req")) { + op_errno = EPERM; + gf_msg_callingfn (this->name, GF_LOG_WARNING, op_errno, + DHT_MSG_GFID_NULL, "mkdir: %s is received " + "without gfid-req %p", loc->path, params); + goto err; + } + dht_get_du_info (frame, this, loc); local = dht_local_init (frame, loc, NULL, GF_FOP_MKDIR); |