|
|
3604df |
From 609555c6610ff61cdf435053cc2186481e677b74 Mon Sep 17 00:00:00 2001
|
|
|
3604df |
From: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
3604df |
Date: Wed, 4 Jan 2017 13:37:23 +0530
|
|
|
3604df |
Subject: [PATCH 265/267] cluster/ec: Do lookup on an existing file in link
|
|
|
3604df |
|
|
|
3604df |
Problem:
|
|
|
3604df |
In link fop lookup is happening on the new fop which doesn't exist so the iatt
|
|
|
3604df |
ec serves parent xlators has size as zero which leads to 'cat' giving empty output
|
|
|
3604df |
|
|
|
3604df |
Fix:
|
|
|
3604df |
Change code so that lookup happens on the existing link instead.
|
|
|
3604df |
|
|
|
3604df |
>BUG: 1409730
|
|
|
3604df |
>Change-Id: I70eb02fe0633e61d1d110575589cc2dbe5235d76
|
|
|
3604df |
>Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
3604df |
>Reviewed-on: http://review.gluster.org/16320
|
|
|
3604df |
>Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
|
|
|
3604df |
>Tested-by: Xavier Hernandez <xhernandez@datalab.es>
|
|
|
3604df |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
3604df |
>NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
3604df |
|
|
|
3604df |
BUG: 1408836
|
|
|
3604df |
Change-Id: I7761048197f8196d5b9db21cf119fe819abd4e8a
|
|
|
3604df |
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
|
|
|
3604df |
Reviewed-on: https://code.engineering.redhat.com/gerrit/94322
|
|
|
3604df |
---
|
|
|
3604df |
xlators/cluster/ec/src/ec-common.c | 7 ++++---
|
|
|
3604df |
xlators/cluster/ec/src/ec-common.h | 2 +-
|
|
|
3604df |
xlators/cluster/ec/src/ec-dir-write.c | 26 +++++++++++++-------------
|
|
|
3604df |
3 files changed, 18 insertions(+), 17 deletions(-)
|
|
|
3604df |
|
|
|
3604df |
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c
|
|
|
3604df |
index 6688ac1..c068cc3 100644
|
|
|
3604df |
--- a/xlators/cluster/ec/src/ec-common.c
|
|
|
3604df |
+++ b/xlators/cluster/ec/src/ec-common.c
|
|
|
3604df |
@@ -788,10 +788,10 @@ void ec_lock_prepare_inode(ec_fop_data_t *fop, loc_t *loc, uint32_t flags)
|
|
|
3604df |
ec_lock_prepare_inode_internal(fop, loc, flags, NULL);
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
-void ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc,
|
|
|
3604df |
+void ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc, loc_t *base,
|
|
|
3604df |
uint32_t flags)
|
|
|
3604df |
{
|
|
|
3604df |
- loc_t tmp, *base = NULL;
|
|
|
3604df |
+ loc_t tmp;
|
|
|
3604df |
int32_t err;
|
|
|
3604df |
|
|
|
3604df |
if (fop->error != 0) {
|
|
|
3604df |
@@ -806,8 +806,9 @@ void ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc,
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
if ((flags & EC_INODE_SIZE) != 0) {
|
|
|
3604df |
- base = loc;
|
|
|
3604df |
flags ^= EC_INODE_SIZE;
|
|
|
3604df |
+ } else {
|
|
|
3604df |
+ base = NULL;
|
|
|
3604df |
}
|
|
|
3604df |
|
|
|
3604df |
ec_lock_prepare_inode_internal(fop, &tmp, flags, base);
|
|
|
3604df |
diff --git a/xlators/cluster/ec/src/ec-common.h b/xlators/cluster/ec/src/ec-common.h
|
|
|
3604df |
index 5851b5d..e3fc3ce 100644
|
|
|
3604df |
--- a/xlators/cluster/ec/src/ec-common.h
|
|
|
3604df |
+++ b/xlators/cluster/ec/src/ec-common.h
|
|
|
3604df |
@@ -90,7 +90,7 @@ gf_boolean_t
|
|
|
3604df |
ec_cbk_set_error(ec_cbk_data_t *cbk, int32_t error, gf_boolean_t ro);
|
|
|
3604df |
|
|
|
3604df |
void ec_lock_prepare_inode(ec_fop_data_t *fop, loc_t *loc, uint32_t flags);
|
|
|
3604df |
-void ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc,
|
|
|
3604df |
+void ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc, loc_t *base,
|
|
|
3604df |
uint32_t flags);
|
|
|
3604df |
void ec_lock_prepare_fd(ec_fop_data_t *fop, fd_t *fd, uint32_t flags);
|
|
|
3604df |
void ec_lock(ec_fop_data_t * fop);
|
|
|
3604df |
diff --git a/xlators/cluster/ec/src/ec-dir-write.c b/xlators/cluster/ec/src/ec-dir-write.c
|
|
|
3604df |
index e181170..e068d77 100644
|
|
|
3604df |
--- a/xlators/cluster/ec/src/ec-dir-write.c
|
|
|
3604df |
+++ b/xlators/cluster/ec/src/ec-dir-write.c
|
|
|
3604df |
@@ -177,7 +177,7 @@ int32_t ec_manager_create(ec_fop_data_t * fop, int32_t state)
|
|
|
3604df |
/* Fall through */
|
|
|
3604df |
|
|
|
3604df |
case EC_STATE_LOCK:
|
|
|
3604df |
- ec_lock_prepare_parent_inode(fop, &fop->loc[0],
|
|
|
3604df |
+ ec_lock_prepare_parent_inode(fop, &fop->loc[0], NULL,
|
|
|
3604df |
EC_UPDATE_DATA | EC_UPDATE_META);
|
|
|
3604df |
ec_lock(fop);
|
|
|
3604df |
|
|
|
3604df |
@@ -355,9 +355,9 @@ int32_t ec_manager_link(ec_fop_data_t * fop, int32_t state)
|
|
|
3604df |
{
|
|
|
3604df |
case EC_STATE_INIT:
|
|
|
3604df |
case EC_STATE_LOCK:
|
|
|
3604df |
- ec_lock_prepare_parent_inode(fop, &fop->loc[1], EC_UPDATE_DATA |
|
|
|
3604df |
- EC_UPDATE_META |
|
|
|
3604df |
- EC_INODE_SIZE);
|
|
|
3604df |
+ ec_lock_prepare_parent_inode(fop, &fop->loc[1], &fop->loc[0],
|
|
|
3604df |
+ EC_UPDATE_DATA | EC_UPDATE_META |
|
|
|
3604df |
+ EC_INODE_SIZE);
|
|
|
3604df |
ec_lock(fop);
|
|
|
3604df |
|
|
|
3604df |
return EC_STATE_DISPATCH;
|
|
|
3604df |
@@ -540,7 +540,7 @@ int32_t ec_manager_mkdir(ec_fop_data_t * fop, int32_t state)
|
|
|
3604df |
/* Fall through */
|
|
|
3604df |
|
|
|
3604df |
case EC_STATE_LOCK:
|
|
|
3604df |
- ec_lock_prepare_parent_inode(fop, &fop->loc[0],
|
|
|
3604df |
+ ec_lock_prepare_parent_inode(fop, &fop->loc[0], NULL,
|
|
|
3604df |
EC_UPDATE_DATA | EC_UPDATE_META);
|
|
|
3604df |
ec_lock(fop);
|
|
|
3604df |
|
|
|
3604df |
@@ -746,7 +746,7 @@ int32_t ec_manager_mknod(ec_fop_data_t * fop, int32_t state)
|
|
|
3604df |
/* Fall through */
|
|
|
3604df |
|
|
|
3604df |
case EC_STATE_LOCK:
|
|
|
3604df |
- ec_lock_prepare_parent_inode(fop, &fop->loc[0],
|
|
|
3604df |
+ ec_lock_prepare_parent_inode(fop, &fop->loc[0], NULL,
|
|
|
3604df |
EC_UPDATE_DATA | EC_UPDATE_META);
|
|
|
3604df |
ec_lock(fop);
|
|
|
3604df |
|
|
|
3604df |
@@ -905,10 +905,10 @@ int32_t ec_manager_rename(ec_fop_data_t * fop, int32_t state)
|
|
|
3604df |
{
|
|
|
3604df |
case EC_STATE_INIT:
|
|
|
3604df |
case EC_STATE_LOCK:
|
|
|
3604df |
- ec_lock_prepare_parent_inode(fop, &fop->loc[0], EC_UPDATE_DATA |
|
|
|
3604df |
- EC_UPDATE_META |
|
|
|
3604df |
- EC_INODE_SIZE);
|
|
|
3604df |
- ec_lock_prepare_parent_inode(fop, &fop->loc[1],
|
|
|
3604df |
+ ec_lock_prepare_parent_inode(fop, &fop->loc[0], &fop->loc[0],
|
|
|
3604df |
+ EC_UPDATE_DATA | EC_UPDATE_META |
|
|
|
3604df |
+ EC_INODE_SIZE);
|
|
|
3604df |
+ ec_lock_prepare_parent_inode(fop, &fop->loc[1], NULL,
|
|
|
3604df |
EC_UPDATE_DATA | EC_UPDATE_META);
|
|
|
3604df |
ec_lock(fop);
|
|
|
3604df |
|
|
|
3604df |
@@ -1067,7 +1067,7 @@ int32_t ec_manager_rmdir(ec_fop_data_t * fop, int32_t state)
|
|
|
3604df |
{
|
|
|
3604df |
case EC_STATE_INIT:
|
|
|
3604df |
case EC_STATE_LOCK:
|
|
|
3604df |
- ec_lock_prepare_parent_inode(fop, &fop->loc[0],
|
|
|
3604df |
+ ec_lock_prepare_parent_inode(fop, &fop->loc[0], NULL,
|
|
|
3604df |
EC_UPDATE_DATA | EC_UPDATE_META);
|
|
|
3604df |
ec_lock(fop);
|
|
|
3604df |
|
|
|
3604df |
@@ -1213,7 +1213,7 @@ int32_t ec_manager_symlink(ec_fop_data_t * fop, int32_t state)
|
|
|
3604df |
{
|
|
|
3604df |
case EC_STATE_INIT:
|
|
|
3604df |
case EC_STATE_LOCK:
|
|
|
3604df |
- ec_lock_prepare_parent_inode(fop, &fop->loc[0],
|
|
|
3604df |
+ ec_lock_prepare_parent_inode(fop, &fop->loc[0], NULL,
|
|
|
3604df |
EC_UPDATE_DATA | EC_UPDATE_META);
|
|
|
3604df |
ec_lock(fop);
|
|
|
3604df |
|
|
|
3604df |
@@ -1379,7 +1379,7 @@ int32_t ec_manager_unlink(ec_fop_data_t * fop, int32_t state)
|
|
|
3604df |
{
|
|
|
3604df |
case EC_STATE_INIT:
|
|
|
3604df |
case EC_STATE_LOCK:
|
|
|
3604df |
- ec_lock_prepare_parent_inode(fop, &fop->loc[0],
|
|
|
3604df |
+ ec_lock_prepare_parent_inode(fop, &fop->loc[0], NULL,
|
|
|
3604df |
EC_UPDATE_DATA | EC_UPDATE_META);
|
|
|
3604df |
ec_lock(fop);
|
|
|
3604df |
|
|
|
3604df |
--
|
|
|
3604df |
2.9.3
|
|
|
3604df |
|