diff options
author | shishir gowda <shishirng@gluster.com> | 2012-03-29 15:17:14 +0530 |
---|---|---|
committer | Vijay Bellur <vijay@gluster.com> | 2012-03-29 07:44:13 -0700 |
commit | 9d884d7139e9c5b3edca2ecb89f7824ac207ad98 (patch) | |
tree | fd23bbb10e17578b6eb30c43197bc5e75dc4f8c7 | |
parent | 834408a49f204e8c256dad4b46d0f19053bf4b0e (diff) |
cluster/dht: send dict with linkto key for lookup in rmdir_readdirp
Without this, if there are any stale link files, rmdir fails with
ENOEMPTY error.
Change-Id: I7056b272122eb5540c22412856f46f638774c119
BUG: 807246
Signed-off-by: shishir gowda <shishirng@gluster.com>
Reviewed-on: http://review.gluster.com/3035
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Amar Tumballi <amarts@redhat.com>
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 0b32a20a1e5..d58cac9fae4 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -4119,6 +4119,7 @@ dht_rmdir_is_subvol_empty (call_frame_t *frame, xlator_t *this, call_frame_t *lookup_frame = NULL; dht_local_t *lookup_local = NULL; dht_local_t *local = NULL; + dict_t *xattrs = NULL; local = frame->local; @@ -4139,6 +4140,21 @@ dht_rmdir_is_subvol_empty (call_frame_t *frame, xlator_t *this, return 0; } + xattrs = dict_new (); + if (!xattrs) { + gf_log (this->name, GF_LOG_ERROR, "dict_new failed"); + return -1; + } + + ret = dict_set_uint32 (xattrs, DHT_LINKFILE_KEY, 256); + if (ret) { + gf_log (this->name, GF_LOG_ERROR, "failed to set linkto key" + " in dict"); + if (xattrs) + dict_unref (xattrs); + return -1; + } + list_for_each_entry (trav, &entries->list, list) { if (strcmp (trav->d_name, ".") == 0) continue; @@ -4182,12 +4198,18 @@ dht_rmdir_is_subvol_empty (call_frame_t *frame, xlator_t *this, STACK_WIND (lookup_frame, dht_rmdir_lookup_cbk, src, src->fops->lookup, - &lookup_local->loc, NULL); + &lookup_local->loc, xattrs); ret++; } + if (xattrs) + dict_unref (xattrs); + return ret; err: + if (xattrs) + dict_unref (xattrs); + DHT_STACK_DESTROY (lookup_frame); return 0; } |