|
|
e3c68b |
From 7c2d6e82d7d3430ad8a557b6ae726765f7e874e9 Mon Sep 17 00:00:00 2001
|
|
|
e3c68b |
From: Kinglong Mee <kinglongmee@gmail.com>
|
|
|
e3c68b |
Date: Fri, 12 Apr 2019 11:35:55 +0800
|
|
|
e3c68b |
Subject: [PATCH 269/276] ec: fix truncate lock to cover the write in tuncate
|
|
|
e3c68b |
clean
|
|
|
e3c68b |
|
|
|
e3c68b |
ec_truncate_clean does writing under the lock granted for truncate,
|
|
|
e3c68b |
but the lock is calculated by ec_adjust_offset_up, so that,
|
|
|
e3c68b |
the write in ec_truncate_clean is out of lock.
|
|
|
e3c68b |
|
|
|
e3c68b |
fixes: bz#1732770
|
|
|
e3c68b |
Upstream-patch: https://review.gluster.org/c/glusterfs/+/22552
|
|
|
e3c68b |
Change-Id: Idbe1fd48d26afe49c36b77db9f12e0907f5a4134
|
|
|
e3c68b |
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
|
|
|
e3c68b |
Reviewed-on: https://code.engineering.redhat.com/gerrit/177973
|
|
|
e3c68b |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
e3c68b |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
e3c68b |
---
|
|
|
e3c68b |
xlators/cluster/ec/src/ec-inode-write.c | 8 ++++++--
|
|
|
e3c68b |
1 file changed, 6 insertions(+), 2 deletions(-)
|
|
|
e3c68b |
|
|
|
e3c68b |
diff --git a/xlators/cluster/ec/src/ec-inode-write.c b/xlators/cluster/ec/src/ec-inode-write.c
|
|
|
e3c68b |
index a903664..ea55140 100644
|
|
|
e3c68b |
--- a/xlators/cluster/ec/src/ec-inode-write.c
|
|
|
e3c68b |
+++ b/xlators/cluster/ec/src/ec-inode-write.c
|
|
|
e3c68b |
@@ -1405,6 +1405,7 @@ int32_t
|
|
|
e3c68b |
ec_manager_truncate(ec_fop_data_t *fop, int32_t state)
|
|
|
e3c68b |
{
|
|
|
e3c68b |
ec_cbk_data_t *cbk;
|
|
|
e3c68b |
+ off_t offset_down;
|
|
|
e3c68b |
|
|
|
e3c68b |
switch (state) {
|
|
|
e3c68b |
case EC_STATE_INIT:
|
|
|
e3c68b |
@@ -1416,16 +1417,19 @@ ec_manager_truncate(ec_fop_data_t *fop, int32_t state)
|
|
|
e3c68b |
/* Fall through */
|
|
|
e3c68b |
|
|
|
e3c68b |
case EC_STATE_LOCK:
|
|
|
e3c68b |
+ offset_down = fop->user_size;
|
|
|
e3c68b |
+ ec_adjust_offset_down(fop->xl->private, &offset_down, _gf_true);
|
|
|
e3c68b |
+
|
|
|
e3c68b |
if (fop->id == GF_FOP_TRUNCATE) {
|
|
|
e3c68b |
ec_lock_prepare_inode(
|
|
|
e3c68b |
fop, &fop->loc[0],
|
|
|
e3c68b |
EC_UPDATE_DATA | EC_UPDATE_META | EC_QUERY_INFO,
|
|
|
e3c68b |
- fop->offset, EC_RANGE_FULL);
|
|
|
e3c68b |
+ offset_down, EC_RANGE_FULL);
|
|
|
e3c68b |
} else {
|
|
|
e3c68b |
ec_lock_prepare_fd(
|
|
|
e3c68b |
fop, fop->fd,
|
|
|
e3c68b |
EC_UPDATE_DATA | EC_UPDATE_META | EC_QUERY_INFO,
|
|
|
e3c68b |
- fop->offset, EC_RANGE_FULL);
|
|
|
e3c68b |
+ offset_down, EC_RANGE_FULL);
|
|
|
e3c68b |
}
|
|
|
e3c68b |
ec_lock(fop);
|
|
|
e3c68b |
|
|
|
e3c68b |
--
|
|
|
e3c68b |
1.8.3.1
|
|
|
e3c68b |
|