From bca47bd4015ead34ac3e380b5839ba32fd701b88 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Sun, 22 Jul 2018 11:37:24 +0530 Subject: performance/write-behind: synchronize rename with cached writes on src rename response contains a postbuf stat of src-inode. Since md-cache caches stat in rename codepath too, we've to make sure stat accounts any cached writes in write-behind. So, we make sure rename is resumed only after any cached writes are committed to backend. Change-Id: Ic9f2adf8edd0b58ebaf661f3a8d0ca086bc63111 Signed-off-by: Raghavendra G Updates: bz#1512691 --- .../performance/write-behind/src/write-behind.c | 40 ++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'xlators/performance/write-behind/src/write-behind.c') diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index 15dd8fa44d0..275c3e97fee 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -2718,6 +2718,45 @@ noqueue: return 0; } +int32_t +wb_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, + dict_t *xdata) +{ + wb_inode_t *wb_inode = NULL; + call_stub_t *stub = NULL; + + wb_inode = wb_inode_ctx_get (this, oldloc->inode); + if (!wb_inode) + goto noqueue; + + stub = fop_rename_stub (frame, default_rename_resume, oldloc, newloc, + xdata); + if (!stub) + goto unwind; + + if (!wb_enqueue (wb_inode, stub)) + goto unwind; + + wb_process_queue (wb_inode); + + return 0; + +unwind: + if (stub) + call_stub_destroy (stub); + + STACK_UNWIND_STRICT (rename, frame, -1, ENOMEM, NULL, NULL, NULL, + NULL, NULL, NULL); + + return 0; + +noqueue: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->rename, oldloc, newloc, + xdata); + return 0; +} + int wb_forget (xlator_t *this, inode_t *inode) @@ -3074,6 +3113,7 @@ struct xlator_fops fops = { .fallocate = wb_fallocate, .discard = wb_discard, .zerofill = wb_zerofill, + .rename = wb_rename, }; -- cgit