|
|
d1681e |
From 5b28188f7a970ccea32d6ed65b75c38703f25045 Mon Sep 17 00:00:00 2001
|
|
|
d1681e |
From: Sunil Kumar Acharya <sheggodu@redhat.com>
|
|
|
d1681e |
Date: Wed, 22 Nov 2017 15:12:26 +0530
|
|
|
d1681e |
Subject: [PATCH 149/180] cluster/ec: EC DISCARD doesn't punch hole properly
|
|
|
d1681e |
|
|
|
d1681e |
Problem:
|
|
|
d1681e |
DISCARD operation on EC volume was punching hole of lesser
|
|
|
d1681e |
size than the specified size in some cases.
|
|
|
d1681e |
|
|
|
d1681e |
Solution:
|
|
|
d1681e |
EC was not handling punch hole for tail part in some cases.
|
|
|
d1681e |
Updated the code to handle it appropriately.
|
|
|
d1681e |
|
|
|
d1681e |
>BUG: 1516206
|
|
|
d1681e |
>Change-Id: If3e69e417c3e5034afee04e78f5f78855e65f932
|
|
|
d1681e |
>Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
|
|
|
d1681e |
|
|
|
d1681e |
Upstream patch: https://review.gluster.org/#/c/18838/
|
|
|
d1681e |
|
|
|
d1681e |
BUG: 1518260
|
|
|
d1681e |
Change-Id: If3e69e417c3e5034afee04e78f5f78855e65f932
|
|
|
d1681e |
Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
|
|
|
d1681e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/124648
|
|
|
d1681e |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
d1681e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
d1681e |
---
|
|
|
d1681e |
tests/basic/ec/ec-discard.t | 10 +++++++++-
|
|
|
d1681e |
xlators/cluster/ec/src/ec-inode-write.c | 6 ++++--
|
|
|
d1681e |
2 files changed, 13 insertions(+), 3 deletions(-)
|
|
|
d1681e |
|
|
|
d1681e |
diff --git a/tests/basic/ec/ec-discard.t b/tests/basic/ec/ec-discard.t
|
|
|
d1681e |
index 4a44cec..001f449 100644
|
|
|
d1681e |
--- a/tests/basic/ec/ec-discard.t
|
|
|
d1681e |
+++ b/tests/basic/ec/ec-discard.t
|
|
|
d1681e |
@@ -137,6 +137,15 @@ TEST md5_sum=`get_md5_sum $B0/test_file`
|
|
|
d1681e |
EXPECT $md5_sum get_md5_sum $M0/test_file
|
|
|
d1681e |
TEST rm -f $B0/test_file $M0/test_file
|
|
|
d1681e |
|
|
|
d1681e |
+#Offset and Size not at boundary covering a stripe
|
|
|
d1681e |
+TEST dd if=/dev/urandom of=$B0/test_file bs=1024 count=8
|
|
|
d1681e |
+TEST cp $B0/test_file $M0/test_file
|
|
|
d1681e |
+TEST fallocate -p -o 1500 -l 3000 $B0/test_file
|
|
|
d1681e |
+TEST fallocate -p -o 1500 -l 3000 $M0/test_file
|
|
|
d1681e |
+TEST md5_sum=`get_md5_sum $B0/test_file`
|
|
|
d1681e |
+EXPECT $md5_sum get_md5_sum $M0/test_file
|
|
|
d1681e |
+TEST rm -f $B0/test_file $M0/test_file
|
|
|
d1681e |
+
|
|
|
d1681e |
#Offset and Size not at boundary
|
|
|
d1681e |
TEST dd if=/dev/urandom of=$B0/test_file bs=1024 count=8
|
|
|
d1681e |
TEST cp $B0/test_file $M0/test_file
|
|
|
d1681e |
@@ -144,7 +153,6 @@ TEST fallocate -p -o 1000 -l 3072 $B0/test_file
|
|
|
d1681e |
TEST fallocate -p -o 1000 -l 3072 $M0/test_file
|
|
|
d1681e |
TEST md5_sum=`get_md5_sum $B0/test_file`
|
|
|
d1681e |
EXPECT $md5_sum get_md5_sum $M0/test_file
|
|
|
d1681e |
-#TEST rm -f $B0/test_file $M0/test_file
|
|
|
d1681e |
|
|
|
d1681e |
#Data Corruption Tests
|
|
|
d1681e |
#Kill brick1 and brick2
|
|
|
d1681e |
diff --git a/xlators/cluster/ec/src/ec-inode-write.c b/xlators/cluster/ec/src/ec-inode-write.c
|
|
|
d1681e |
index ae51202..2c1165b 100644
|
|
|
d1681e |
--- a/xlators/cluster/ec/src/ec-inode-write.c
|
|
|
d1681e |
+++ b/xlators/cluster/ec/src/ec-inode-write.c
|
|
|
d1681e |
@@ -1144,11 +1144,13 @@ void ec_update_discard_write(ec_fop_data_t *fop, uintptr_t mask)
|
|
|
d1681e |
error = ec_update_write (fop, mask, off_head, fop->user_size);
|
|
|
d1681e |
} else {
|
|
|
d1681e |
size_head = fop->int32;
|
|
|
d1681e |
- size_tail = (fop->user_size - fop->int32) % ec->stripe_size;
|
|
|
d1681e |
+ size_tail = (off_head + fop->user_size) % ec->stripe_size;
|
|
|
d1681e |
off_tail = off_head + fop->user_size - size_tail;
|
|
|
d1681e |
if (size_head) {
|
|
|
d1681e |
error = ec_update_write (fop, mask, off_head, size_head);
|
|
|
d1681e |
- goto out;
|
|
|
d1681e |
+ if (error) {
|
|
|
d1681e |
+ goto out;
|
|
|
d1681e |
+ }
|
|
|
d1681e |
}
|
|
|
d1681e |
if (size_tail) {
|
|
|
d1681e |
error = ec_update_write (fop, mask, off_tail, size_tail);
|
|
|
d1681e |
--
|
|
|
d1681e |
1.8.3.1
|
|
|
d1681e |
|