summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/dht
diff options
context:
space:
mode:
Diffstat (limited to 'xlators/cluster/dht')
-rw-r--r--xlators/cluster/dht/src/dht-common.c45
1 files changed, 45 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index 96f540d721c..3421c1de657 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -3736,6 +3736,42 @@ err:
return 0;
}
+int
+dht_nuke_dir (call_frame_t *frame, xlator_t *this, loc_t *loc, data_t *tmp)
+{
+ if (!IA_ISDIR(loc->inode->ia_type)) {
+ DHT_STACK_UNWIND (setxattr, frame, -1, ENOTSUP, NULL);
+ return 0;
+ }
+
+ /* Setxattr didn't need the parent, but rmdir does. */
+ loc->parent = inode_parent (loc->inode, NULL, NULL);
+ if (!loc->parent) {
+ DHT_STACK_UNWIND (setxattr, frame, -1, ENOENT, NULL);
+ return 0;
+ }
+ gf_uuid_copy (loc->pargfid, loc->parent->gfid);
+
+ if (!loc->name && loc->path) {
+ loc->name = strrchr (loc->path, '/');
+ if (loc->name) {
+ ++(loc->name);
+ }
+ }
+
+ /*
+ * We do this instead of calling dht_rmdir_do directly for two reasons.
+ * The first is that we want to reuse all of the initialization that
+ * dht_rmdir does, so if it ever changes we'll just follow along. The
+ * second (i.e. why we don't use STACK_WIND_TAIL) is so that we don't
+ * obscure the fact that we came in via this path instead of a genuine
+ * rmdir. That makes debugging just a tiny bit easier.
+ */
+ STACK_WIND (frame, default_rmdir_cbk, this, this->fops->rmdir,
+ loc, 1, NULL);
+
+ return 0;
+}
int
dht_setxattr (call_frame_t *frame, xlator_t *this,
@@ -3960,6 +3996,11 @@ dht_setxattr (call_frame_t *frame, xlator_t *this,
goto err;
}
+ tmp = dict_get (xattr, "glusterfs.dht.nuke");
+ if (tmp) {
+ return dht_nuke_dir (frame, this, loc, tmp);
+ }
+
if (IA_ISDIR (loc->inode->ia_type)) {
for (i = 0; i < call_cnt; i++) {
@@ -8231,6 +8272,10 @@ dht_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
goto err;
}
+ if (flags) {
+ return dht_rmdir_do (frame, this);
+ }
+
for (i = 0; i < conf->subvolume_cnt; i++) {
STACK_WIND (frame, dht_rmdir_opendir_cbk,
conf->subvolumes[i],