summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/afr/src/afr-dir-write.c5
-rw-r--r--xlators/cluster/afr/src/afr-dir-write.h2
-rw-r--r--xlators/cluster/afr/src/afr.h1
-rw-r--r--xlators/cluster/afr/src/pump.c17
-rw-r--r--xlators/cluster/dht/src/dht-common.c6
-rw-r--r--xlators/cluster/stripe/src/stripe.c8
-rw-r--r--xlators/debug/error-gen/src/error-gen.c4
-rw-r--r--xlators/debug/io-stats/src/io-stats.c4
-rw-r--r--xlators/debug/trace/src/trace.c8
-rw-r--r--xlators/features/access-control/src/access-control.c12
-rw-r--r--xlators/features/quiesce/src/quiesce.c14
-rw-r--r--xlators/features/quota/src/quota.c8
-rw-r--r--xlators/features/read-only/src/read-only.c5
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c2
-rw-r--r--xlators/nfs/server/src/nfs-fops.c2
-rw-r--r--xlators/performance/io-threads/src/io-threads.c8
-rw-r--r--xlators/performance/stat-prefetch/src/stat-prefetch.c14
-rw-r--r--xlators/protocol/client/src/client.c3
-rw-r--r--xlators/protocol/client/src/client3_1-fops.c1
-rw-r--r--xlators/protocol/server/src/server3_1-fops.c4
-rw-r--r--xlators/storage/posix/src/posix.c21
21 files changed, 88 insertions, 61 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-write.c b/xlators/cluster/afr/src/afr-dir-write.c
index 1aa268f66e4..1226285f777 100644
--- a/xlators/cluster/afr/src/afr-dir-write.c
+++ b/xlators/cluster/afr/src/afr-dir-write.c
@@ -1900,7 +1900,7 @@ afr_rmdir_wind (call_frame_t *frame, xlator_t *this)
(void *) (long) i,
priv->children[i],
priv->children[i]->fops->rmdir,
- &local->loc);
+ &local->loc, local->cont.rmdir.flags);
if (!--call_count)
break;
@@ -1926,7 +1926,7 @@ afr_rmdir_done (call_frame_t *frame, xlator_t *this)
int
afr_rmdir (call_frame_t *frame, xlator_t *this,
- loc_t *loc)
+ loc_t *loc, int flags)
{
afr_private_t * priv = NULL;
afr_local_t * local = NULL;
@@ -1960,6 +1960,7 @@ afr_rmdir (call_frame_t *frame, xlator_t *this,
transaction_frame->local = local;
+ local->cont.rmdir.flags = flags;
loc_copy (&local->loc, loc);
if (loc->parent)
diff --git a/xlators/cluster/afr/src/afr-dir-write.h b/xlators/cluster/afr/src/afr-dir-write.h
index e2ed8c759d0..40aeb1f5850 100644
--- a/xlators/cluster/afr/src/afr-dir-write.h
+++ b/xlators/cluster/afr/src/afr-dir-write.h
@@ -39,7 +39,7 @@ afr_unlink (call_frame_t *frame, xlator_t *this,
int32_t
afr_rmdir (call_frame_t *frame, xlator_t *this,
- loc_t *loc);
+ loc_t *loc, int flags);
int32_t
afr_link (call_frame_t *frame, xlator_t *this,
diff --git a/xlators/cluster/afr/src/afr.h b/xlators/cluster/afr/src/afr.h
index ed50fdfbfd2..56a5fb106c3 100644
--- a/xlators/cluster/afr/src/afr.h
+++ b/xlators/cluster/afr/src/afr.h
@@ -531,6 +531,7 @@ typedef struct _afr_local {
} unlink;
struct {
+ int flags;
ino_t parent_ino;
int32_t op_ret;
int32_t op_errno;
diff --git a/xlators/cluster/afr/src/pump.c b/xlators/cluster/afr/src/pump.c
index 1a9277abc9b..39de7cbb9ba 100644
--- a/xlators/cluster/afr/src/pump.c
+++ b/xlators/cluster/afr/src/pump.c
@@ -1719,22 +1719,23 @@ pump_unlink (call_frame_t *frame,
}
-static int32_t
-pump_rmdir (call_frame_t *frame,
- xlator_t *this,
- loc_t *loc)
+static int
+pump_rmdir (call_frame_t *frame, xlator_t *this,
+ loc_t *loc, int flags)
{
afr_private_t *priv = NULL;
+
priv = this->private;
+
if (!priv->use_afr_in_pump) {
- STACK_WIND (frame,
- default_rmdir_cbk,
+ STACK_WIND (frame, default_rmdir_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->rmdir,
- loc);
+ loc, flags);
return 0;
}
- afr_rmdir (frame, this, loc);
+
+ afr_rmdir (frame, this, loc, flags);
return 0;
}
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index a262ba6ca67..6001cd3180a 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -3860,7 +3860,7 @@ dht_rmdir_do (call_frame_t *frame, xlator_t *this)
STACK_WIND (frame, dht_rmdir_cbk,
conf->subvolumes[i],
conf->subvolumes[i]->fops->rmdir,
- &local->loc);
+ &local->loc, local->flags);
}
return 0;
@@ -4127,7 +4127,7 @@ err:
int
-dht_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
+dht_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
{
dht_local_t *local = NULL;
dht_conf_t *conf = NULL;
@@ -4163,6 +4163,8 @@ dht_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
goto err;
}
+ local->flags = flags;
+
local->fd = fd_create (local->loc.inode, frame->root->pid);
if (!local->fd) {
gf_log (this->name, GF_LOG_ERROR,
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c
index 72c7b4515e2..f6118a6f048 100644
--- a/xlators/cluster/stripe/src/stripe.c
+++ b/xlators/cluster/stripe/src/stripe.c
@@ -1143,7 +1143,8 @@ stripe_first_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
while (trav) {
STACK_WIND (frame, stripe_unlink_cbk, trav->xlator,
- trav->xlator->fops->rmdir, &local->loc);
+ trav->xlator->fops->rmdir, &local->loc,
+ local->flags);
trav = trav->next;
}
@@ -1155,7 +1156,7 @@ err:
}
int32_t
-stripe_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
+stripe_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
{
xlator_list_t *trav = NULL;
stripe_local_t *local = NULL;
@@ -1187,10 +1188,11 @@ stripe_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
local->op_ret = -1;
frame->local = local;
loc_copy (&local->loc, loc);
+ local->flags = flags;
local->call_count = priv->child_count;
STACK_WIND (frame, stripe_first_rmdir_cbk, trav->xlator,
- trav->xlator->fops->rmdir, loc);
+ trav->xlator->fops->rmdir, loc, flags);
return 0;
err:
diff --git a/xlators/debug/error-gen/src/error-gen.c b/xlators/debug/error-gen/src/error-gen.c
index b9ed44b2101..7fd467a8b9a 100644
--- a/xlators/debug/error-gen/src/error-gen.c
+++ b/xlators/debug/error-gen/src/error-gen.c
@@ -807,7 +807,7 @@ error_gen_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-error_gen_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
+error_gen_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
{
int op_errno = 0;
eg_t *egp = NULL;
@@ -828,7 +828,7 @@ error_gen_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
STACK_WIND (frame, error_gen_rmdir_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->rmdir,
- loc);
+ loc, flags);
return 0;
}
diff --git a/xlators/debug/io-stats/src/io-stats.c b/xlators/debug/io-stats/src/io-stats.c
index 2d56ecf6a0f..bf513184025 100644
--- a/xlators/debug/io-stats/src/io-stats.c
+++ b/xlators/debug/io-stats/src/io-stats.c
@@ -1044,7 +1044,7 @@ io_stats_unlink (call_frame_t *frame, xlator_t *this,
int
io_stats_rmdir (call_frame_t *frame, xlator_t *this,
- loc_t *loc)
+ loc_t *loc, int flags)
{
BUMP_FOP (RMDIR);
@@ -1053,7 +1053,7 @@ io_stats_rmdir (call_frame_t *frame, xlator_t *this,
STACK_WIND (frame, io_stats_rmdir_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->rmdir,
- loc);
+ loc, flags);
return 0;
}
diff --git a/xlators/debug/trace/src/trace.c b/xlators/debug/trace/src/trace.c
index c1de19104f8..1343d758d9d 100644
--- a/xlators/debug/trace/src/trace.c
+++ b/xlators/debug/trace/src/trace.c
@@ -1525,18 +1525,18 @@ trace_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc)
int
-trace_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
+trace_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
{
if (trace_fop_names[GF_FOP_RMDIR].enabled) {
gf_log (this->name, GF_LOG_NORMAL,
- "%"PRId64": (loc {path=%s, ino=%"PRIu64"})",
- frame->root->unique, loc->path, loc->inode->ino);
+ "%"PRId64": (loc {path=%s, ino=%"PRIu64"}, flags=%d)",
+ frame->root->unique, loc->path, loc->inode->ino, flags);
}
STACK_WIND (frame, trace_rmdir_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->rmdir,
- loc);
+ loc, flags);
return 0;
}
diff --git a/xlators/features/access-control/src/access-control.c b/xlators/features/access-control/src/access-control.c
index 34422f9ca0c..a8aae9780ff 100644
--- a/xlators/features/access-control/src/access-control.c
+++ b/xlators/features/access-control/src/access-control.c
@@ -788,11 +788,11 @@ out:
}
-int32_t
-ac_rmdir_resume (call_frame_t *frame, xlator_t *this, loc_t *loc)
+int
+ac_rmdir_resume (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
{
STACK_WIND (frame, default_rmdir_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->rmdir, loc);
+ FIRST_CHILD(this)->fops->rmdir, loc, flags);
return 0;
}
@@ -827,14 +827,14 @@ out:
}
-int32_t
-ac_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
+int
+ac_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
{
call_stub_t *stub = NULL;
int ret = -EFAULT;
loc_t parentloc = {0, };
- stub = fop_rmdir_stub (frame, ac_rmdir_resume, loc);
+ stub = fop_rmdir_stub (frame, ac_rmdir_resume, loc, flags);
if (!stub) {
gf_log (this->name, GF_LOG_ERROR, "cannot create call stub: "
"(out of memory)");
diff --git a/xlators/features/quiesce/src/quiesce.c b/xlators/features/quiesce/src/quiesce.c
index 168e32373d5..32fac39bb0a 100644
--- a/xlators/features/quiesce/src/quiesce.c
+++ b/xlators/features/quiesce/src/quiesce.c
@@ -628,10 +628,9 @@ quiesce_symlink (call_frame_t *frame, xlator_t *this,
return 0;
}
-int32_t
-quiesce_rmdir (call_frame_t *frame,
- xlator_t *this,
- loc_t *loc)
+
+int
+quiesce_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
{
quiesce_priv_t *priv = NULL;
call_stub_t *stub = NULL;
@@ -639,15 +638,14 @@ quiesce_rmdir (call_frame_t *frame,
priv = this->private;
if (priv->pass_through) {
- STACK_WIND (frame,
- default_rmdir_cbk,
+ STACK_WIND (frame, default_rmdir_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->rmdir,
- loc);
+ loc, flags);
return 0;
}
- stub = fop_rmdir_stub (frame, default_rmdir_resume, loc);
+ stub = fop_rmdir_stub (frame, default_rmdir_resume, loc, flags);
if (!stub) {
STACK_UNWIND_STRICT (rmdir, frame, -1, ENOMEM, NULL, NULL);
return 0;
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index 094b62d4a56..0f862e090b8 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -43,6 +43,7 @@ struct quota_local {
struct iovec vector[MAX_IOVEC];
struct iobref *iobref;
loc_t loc;
+ int flags;
};
@@ -520,14 +521,14 @@ quota_rmdir_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
STACK_WIND (frame, quota_rmdir_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->rmdir,
- &local->loc);
+ &local->loc, local->flags);
return 0;
}
int
-quota_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
+quota_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
{
struct quota_local *local = NULL;
struct quota_priv *priv = NULL;
@@ -540,6 +541,7 @@ quota_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
frame->local = local;
loc_copy (&local->loc, loc);
+ local->flags = flags;
STACK_WIND (frame, quota_rmdir_stat_cbk,
FIRST_CHILD(this),
@@ -550,7 +552,7 @@ quota_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
STACK_WIND (frame, quota_rmdir_cbk,
FIRST_CHILD(this),
FIRST_CHILD(this)->fops->rmdir,
- loc);
+ loc, flags);
return 0;
}
diff --git a/xlators/features/read-only/src/read-only.c b/xlators/features/read-only/src/read-only.c
index 8c71f0a0d78..fe0e95b9fd1 100644
--- a/xlators/features/read-only/src/read-only.c
+++ b/xlators/features/read-only/src/read-only.c
@@ -137,8 +137,9 @@ ro_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc)
return 0;
}
-int32_t
-ro_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
+
+int
+ro_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
{
STACK_UNWIND_STRICT (rmdir, frame, -1, EROFS, NULL, NULL);
return 0;
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index b6497b15efd..64ac765c0dc 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -1179,7 +1179,7 @@ fuse_rmdir_resume (fuse_state_t *state)
state->loc.path);
FUSE_FOP (state, fuse_unlink_cbk, GF_FOP_RMDIR,
- rmdir, &state->loc);
+ rmdir, &state->loc, 0);
}
static void
diff --git a/xlators/nfs/server/src/nfs-fops.c b/xlators/nfs/server/src/nfs-fops.c
index 3f342710b25..e9633748bcc 100644
--- a/xlators/nfs/server/src/nfs-fops.c
+++ b/xlators/nfs/server/src/nfs-fops.c
@@ -941,7 +941,7 @@ nfs_fop_rmdir (xlator_t *nfsx, xlator_t *xl, nfs_user_t *nfu, loc_t *pathloc,
nfs_fop_save_root_ino (nfl, pathloc);
STACK_WIND_COOKIE (frame, nfs_fop_rmdir_cbk, xl, xl, xl->fops->rmdir,
- pathloc);
+ pathloc, 0);
ret = 0;
err:
if (ret < 0) {
diff --git a/xlators/performance/io-threads/src/io-threads.c b/xlators/performance/io-threads/src/io-threads.c
index 3d072d20fca..458dd9cbf57 100644
--- a/xlators/performance/io-threads/src/io-threads.c
+++ b/xlators/performance/io-threads/src/io-threads.c
@@ -534,21 +534,21 @@ iot_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
int
-iot_rmdir_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc)
+iot_rmdir_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
{
STACK_WIND (frame, iot_rmdir_cbk, FIRST_CHILD (this),
- FIRST_CHILD (this)->fops->rmdir, loc);
+ FIRST_CHILD (this)->fops->rmdir, loc, flags);
return 0;
}
int
-iot_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
+iot_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
{
call_stub_t *stub = NULL;
int ret = -1;
- stub = fop_rmdir_stub (frame, iot_rmdir_wrapper, loc);
+ stub = fop_rmdir_stub (frame, iot_rmdir_wrapper, loc, flags);
if (!stub) {
gf_log (this->name, GF_LOG_ERROR, "cannot create rmdir stub"
"(out of memory)");
diff --git a/xlators/performance/stat-prefetch/src/stat-prefetch.c b/xlators/performance/stat-prefetch/src/stat-prefetch.c
index 76ae9d20980..e3ecb097ad0 100644
--- a/xlators/performance/stat-prefetch/src/stat-prefetch.c
+++ b/xlators/performance/stat-prefetch/src/stat-prefetch.c
@@ -2403,8 +2403,8 @@ out:
}
-int32_t
-sp_rmdir_helper (call_frame_t *frame, xlator_t *this, loc_t *loc)
+int
+sp_rmdir_helper (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
{
uint64_t value = 0;
sp_inode_ctx_t *inode_ctx = NULL;
@@ -2434,7 +2434,7 @@ sp_rmdir_helper (call_frame_t *frame, xlator_t *this, loc_t *loc)
}
STACK_WIND (frame, sp_unlink_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->rmdir, loc);
+ FIRST_CHILD(this)->fops->rmdir, loc, flags);
return 0;
@@ -2444,8 +2444,8 @@ unwind:
}
-int32_t
-sp_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
+int
+sp_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
{
int32_t ret = -1, op_errno = -1;
call_stub_t *stub = NULL;
@@ -2470,7 +2470,7 @@ sp_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
goto out;
}
- stub = fop_rmdir_stub (frame, sp_rmdir_helper, loc);
+ stub = fop_rmdir_stub (frame, sp_rmdir_helper, loc, flags);
if (stub == NULL) {
op_errno = ENOMEM;
gf_log (this->name, GF_LOG_ERROR, "out of memory");
@@ -2489,7 +2489,7 @@ out:
FIRST_CHILD(this)->fops->lookup, loc, NULL);
} else if (can_wind) {
STACK_WIND (frame, sp_unlink_cbk, FIRST_CHILD(this),
- FIRST_CHILD(this)->fops->rmdir, loc);
+ FIRST_CHILD(this)->fops->rmdir, loc, flags);
}
return 0;
diff --git a/xlators/protocol/client/src/client.c b/xlators/protocol/client/src/client.c
index 4297c628dc0..e64d8135fff 100644
--- a/xlators/protocol/client/src/client.c
+++ b/xlators/protocol/client/src/client.c
@@ -444,7 +444,7 @@ out:
}
int32_t
-client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
+client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags)
{
int ret = -1;
clnt_conf_t *conf = NULL;
@@ -456,6 +456,7 @@ client_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc)
goto out;
args.loc = loc;
+ args.flags = flags;
proc = &conf->fops->proctable[GF_FOP_RMDIR];
if (proc->fn)
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index f4a9b198808..9b6d2bb7145 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -2855,6 +2855,7 @@ client3_1_rmdir (call_frame_t *frame, xlator_t *this,
memcpy (req.pargfid, args->loc->parent->gfid, 16);
req.path = (char *)args->loc->path;
req.bname = (char *)args->loc->name;
+ req.flags = args->flags;
conf = this->private;
ret = client_submit_request (this, &req, frame, conf->fops,
diff --git a/xlators/protocol/server/src/server3_1-fops.c b/xlators/protocol/server/src/server3_1-fops.c
index d156e3cc386..b996778ef1c 100644
--- a/xlators/protocol/server/src/server3_1-fops.c
+++ b/xlators/protocol/server/src/server3_1-fops.c
@@ -1956,7 +1956,7 @@ server_rmdir_resume (call_frame_t *frame, xlator_t *bound_xl)
goto err;
STACK_WIND (frame, server_rmdir_cbk,
- bound_xl, bound_xl->fops->rmdir, &state->loc);
+ bound_xl, bound_xl->fops->rmdir, &state->loc, state->flags);
return 0;
err:
server_rmdir_cbk (frame, NULL, frame->this, state->resolve.op_ret,
@@ -4256,6 +4256,8 @@ server_rmdir (rpcsvc_request_t *req)
state->resolve.path = gf_strdup (args.path);
state->resolve.bname = gf_strdup (args.bname);
+ state->flags = args.flags;
+
resolve_and_resume (frame, server_rmdir_resume);
out:
return 0;
diff --git a/xlators/storage/posix/src/posix.c b/xlators/storage/posix/src/posix.c
index 398c1dd7e8b..d6874073bf1 100644
--- a/xlators/storage/posix/src/posix.c
+++ b/xlators/storage/posix/src/posix.c
@@ -54,6 +54,7 @@
#include "locking.h"
#include "timer.h"
#include "glusterfs3-xdr.h"
+#include "hashfn.h"
#undef HAVE_SET_FSID
#ifdef HAVE_SET_FSID
@@ -1480,9 +1481,10 @@ posix_unlink (call_frame_t *frame, xlator_t *this,
return 0;
}
-int32_t
+
+int
posix_rmdir (call_frame_t *frame, xlator_t *this,
- loc_t *loc)
+ loc_t *loc, int flags)
{
int32_t op_ret = -1;
int32_t op_errno = 0;
@@ -1491,6 +1493,7 @@ posix_rmdir (call_frame_t *frame, xlator_t *this,
char * parentpath = NULL;
struct iatt preparent = {0,};
struct iatt postparent = {0,};
+ struct posix_private *priv = NULL;
DECLARE_OLD_FS_ID_VAR;
@@ -1498,6 +1501,8 @@ posix_rmdir (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (this, out);
VALIDATE_OR_GOTO (loc, out);
+ priv = this->private;
+
SET_FS_ID (frame->root->uid, frame->root->gid);
MAKE_REAL_PATH (real_path, this, loc->path);
@@ -1515,7 +1520,17 @@ posix_rmdir (call_frame_t *frame, xlator_t *this,
goto out;
}
- op_ret = rmdir (real_path);
+ if (flags) {
+ uint32_t hashval = 0;
+ char *tmp_path = alloca (strlen (priv->trash_path) + 16);
+
+ mkdir (priv->trash_path, 0755);
+ hashval = gf_dm_hashfn (real_path, strlen (real_path));
+ sprintf (tmp_path, "%s/%u", priv->trash_path, hashval);
+ op_ret = rename (real_path, tmp_path);
+ } else {
+ op_ret = rmdir (real_path);
+ }
op_errno = errno;
if (op_errno == EEXIST)