diff options
author | Raghavendra G <rgowdapp@redhat.com> | 2018-07-22 11:37:24 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2018-08-02 03:01:02 +0000 |
commit | bca47bd4015ead34ac3e380b5839ba32fd701b88 (patch) | |
tree | 3288b5a3d257e27f226ba61afab88b8ad5727b9f /xlators/performance | |
parent | fe5d8d3643c2bc2fdb95b0351b26fb286cf778b7 (diff) |
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 <rgowdapp@redhat.com>
Updates: bz#1512691
Diffstat (limited to 'xlators/performance')
-rw-r--r-- | xlators/performance/write-behind/src/write-behind.c | 40 |
1 files changed, 40 insertions, 0 deletions
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, }; |