summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnand Avati <avati@redhat.com>2012-09-24 11:57:14 -0700
committerVijay Bellur <vbellur@redhat.com>2012-12-12 00:17:08 -0500
commit187bf4117117904d9a15fb386a6cff4ca6f89fbe (patch)
tree6ead7199188e6269bb6269a585971d2a6e88aaf0
parentee8f3f9bbf47e2b55930b33125ffdc2e6f5ca498 (diff)
write-behind: fix off-by-one bug in wb_requests_overlap()
and backport an upstream review comment Change-Id: If683ee051cc3bd969417d69705bd63343650b541 Signed-off-by: Anand Avati <avati@redhat.com> Reviewed-on: https://code.engineering.redhat.com/gerrit/1869 Reviewed-by: Vijay Bellur <vbellur@redhat.com> Tested-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r--xlators/performance/write-behind/src/write-behind.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c
index aedfdbb..dd991e6 100644
--- a/xlators/performance/write-behind/src/write-behind.c
+++ b/xlators/performance/write-behind/src/write-behind.c
@@ -239,13 +239,13 @@ wb_requests_overlap (wb_request_t *req1, wb_request_t *req2)
r1_start = req1->ordering.off;
if (req1->ordering.size)
- r1_end = r1_start + req1->ordering.size;
+ r1_end = r1_start + req1->ordering.size - 1;
else
r1_end = ULLONG_MAX;
r2_start = req2->ordering.off;
if (req2->ordering.size)
- r2_end = r2_start + req2->ordering.size;
+ r2_end = r2_start + req2->ordering.size - 1;
else
r2_end = ULLONG_MAX;
@@ -926,11 +926,6 @@ __wb_preprocess_winds (wb_inode_t *wb_inode)
conf = wb_inode->this->private;
list_for_each_entry_safe (req, tmp, &wb_inode->todo, todo) {
- if (!holder) {
- holder = req;
- continue;
- }
-
if (!req->ordering.tempted) {
if (holder) {
if (wb_requests_conflict (holder, req))
@@ -940,6 +935,10 @@ __wb_preprocess_winds (wb_inode_t *wb_inode)
}
/* collapse only non-sync writes */
continue;
+ } else if (!holder) {
+ /* holder is always a non-sync write */
+ holder = req;
+ continue;
}
offset_expected = holder->stub->args.writev.off