summaryrefslogtreecommitdiffstats
path: root/xlators/features/marker/src/marker-quota.c
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2016-04-06 14:09:50 +0530
committerVijaikumar Mallikarjuna <vmallika@redhat.com>2016-04-06 05:15:00 -0700
commitcd22b5c1a490444620c1d19ce22672ff1cd478a6 (patch)
treec9746ae83e6bc2bdbf5d89668674803d7f1403c3 /xlators/features/marker/src/marker-quota.c
parent1546572b7d46c1aee906608140c843160a529937 (diff)
marker: do mq_reduce_parent_size_txn in FG for unlink & rmdir
* If a "rm -rf" is performed by a client, we initiate a marker background operation mq_reduce_parent_size_txn for rmdir and unlink. mq_reduce_parent_size_txn can fail when updating size on the ancestor directories, if these directories are removed during the txn as the child-parent association removed in the dentry list. So execute mq_reduce_parent_size_txn in foreground and then do the UNWIND for rmdir and unlink FOP Change-Id: Iefcdced4c6ae0dbd43f92814d0ddcd1e33825864 BUG: 1322489 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/13874 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Raghavendra G <rgowdapp@redhat.com> CentOS-regression: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/features/marker/src/marker-quota.c')
-rw-r--r--xlators/features/marker/src/marker-quota.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/xlators/features/marker/src/marker-quota.c b/xlators/features/marker/src/marker-quota.c
index 9d2f3d375e5..c7d050a42a2 100644
--- a/xlators/features/marker/src/marker-quota.c
+++ b/xlators/features/marker/src/marker-quota.c
@@ -1046,6 +1046,9 @@ mq_synctask_cleanup (int ret, call_frame_t *frame, void *opaque)
args = (quota_synctask_t *) opaque;
loc_wipe (&args->loc);
+ if (args->stub)
+ call_resume (args->stub);
+
if (!args->is_static)
GF_FREE (args);
@@ -1054,7 +1057,8 @@ mq_synctask_cleanup (int ret, call_frame_t *frame, void *opaque)
int
mq_synctask1 (xlator_t *this, synctask_fn_t task, gf_boolean_t spawn,
- loc_t *loc, quota_meta_t *contri, uint32_t nlink)
+ loc_t *loc, quota_meta_t *contri, uint32_t nlink,
+ call_stub_t *stub)
{
int32_t ret = -1;
quota_synctask_t *args = NULL;
@@ -1069,6 +1073,7 @@ mq_synctask1 (xlator_t *this, synctask_fn_t task, gf_boolean_t spawn,
}
args->this = this;
+ args->stub = stub;
loc_copy (&args->loc, loc);
args->ia_nlink = nlink;
@@ -1100,7 +1105,7 @@ out:
int
mq_synctask (xlator_t *this, synctask_fn_t task, gf_boolean_t spawn, loc_t *loc)
{
- return mq_synctask1 (this, task, spawn, loc, NULL, -1);
+ return mq_synctask1 (this, task, spawn, loc, NULL, -1, NULL);
}
int32_t
@@ -1407,10 +1412,12 @@ out:
int32_t
mq_reduce_parent_size_txn (xlator_t *this, loc_t *origin_loc,
- quota_meta_t *contri, uint32_t nlink)
+ quota_meta_t *contri, uint32_t nlink,
+ call_stub_t *stub)
{
int32_t ret = -1;
loc_t loc = {0, };
+ gf_boolean_t resume_stub = _gf_true;
GF_VALIDATE_OR_GOTO ("marker", this, out);
GF_VALIDATE_OR_GOTO ("marker", origin_loc, out);
@@ -1424,11 +1431,19 @@ mq_reduce_parent_size_txn (xlator_t *this, loc_t *origin_loc,
goto out;
}
+ resume_stub = _gf_false;
ret = mq_synctask1 (this, mq_reduce_parent_size_task, _gf_true, &loc,
- contri, nlink);
+ contri, nlink, stub);
out:
loc_wipe (&loc);
+ if (resume_stub && stub)
+ call_resume (stub);
+
+ if (ret)
+ gf_log_callingfn (this->name, GF_LOG_ERROR,
+ "mq_reduce_parent_size_txn failed");
+
return ret;
}