diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2017-01-04 13:37:23 +0530 |
---|---|---|
committer | Pranith Kumar Karampuri <pkarampu@redhat.com> | 2017-01-05 21:19:21 -0800 |
commit | 395c55483724912821929ff2a793e99fd7bf4e71 (patch) | |
tree | 1fff324219788367a79cec312022b1364a01f30a /xlators | |
parent | 95d07a3d2d68805d93d36a447436e27c48777939 (diff) |
cluster/ec: Do lookup on an existing file in link
Problem:
In link fop lookup is happening on the new fop which doesn't exist so the iatt
ec serves parent xlators has size as zero which leads to 'cat' giving empty output
Fix:
Change code so that lookup happens on the existing link instead.
BUG: 1409730
Change-Id: I70eb02fe0633e61d1d110575589cc2dbe5235d76
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/16320
Smoke: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
Tested-by: Xavier Hernandez <xhernandez@datalab.es>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/ec/src/ec-common.c | 7 | ||||
-rw-r--r-- | xlators/cluster/ec/src/ec-common.h | 2 | ||||
-rw-r--r-- | xlators/cluster/ec/src/ec-dir-write.c | 26 |
3 files changed, 18 insertions, 17 deletions
diff --git a/xlators/cluster/ec/src/ec-common.c b/xlators/cluster/ec/src/ec-common.c index 79bf2487216..5cbc1d31e1d 100644 --- a/xlators/cluster/ec/src/ec-common.c +++ b/xlators/cluster/ec/src/ec-common.c @@ -788,10 +788,10 @@ void ec_lock_prepare_inode(ec_fop_data_t *fop, loc_t *loc, uint32_t flags) ec_lock_prepare_inode_internal(fop, loc, flags, NULL); } -void ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc, +void ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc, loc_t *base, uint32_t flags) { - loc_t tmp, *base = NULL; + loc_t tmp; int32_t err; if (fop->error != 0) { @@ -806,8 +806,9 @@ void ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc, } if ((flags & EC_INODE_SIZE) != 0) { - base = loc; flags ^= EC_INODE_SIZE; + } else { + base = NULL; } ec_lock_prepare_inode_internal(fop, &tmp, flags, base); diff --git a/xlators/cluster/ec/src/ec-common.h b/xlators/cluster/ec/src/ec-common.h index 5851b5d57b0..e3fc3cef075 100644 --- a/xlators/cluster/ec/src/ec-common.h +++ b/xlators/cluster/ec/src/ec-common.h @@ -90,7 +90,7 @@ gf_boolean_t ec_cbk_set_error(ec_cbk_data_t *cbk, int32_t error, gf_boolean_t ro); void ec_lock_prepare_inode(ec_fop_data_t *fop, loc_t *loc, uint32_t flags); -void ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc, +void ec_lock_prepare_parent_inode(ec_fop_data_t *fop, loc_t *loc, loc_t *base, uint32_t flags); void ec_lock_prepare_fd(ec_fop_data_t *fop, fd_t *fd, uint32_t flags); void ec_lock(ec_fop_data_t * fop); diff --git a/xlators/cluster/ec/src/ec-dir-write.c b/xlators/cluster/ec/src/ec-dir-write.c index 1272e3dfe0d..150dc66f21b 100644 --- a/xlators/cluster/ec/src/ec-dir-write.c +++ b/xlators/cluster/ec/src/ec-dir-write.c @@ -178,7 +178,7 @@ int32_t ec_manager_create(ec_fop_data_t * fop, int32_t state) /* Fall through */ case EC_STATE_LOCK: - ec_lock_prepare_parent_inode(fop, &fop->loc[0], + ec_lock_prepare_parent_inode(fop, &fop->loc[0], NULL, EC_UPDATE_DATA | EC_UPDATE_META); ec_lock(fop); @@ -356,9 +356,9 @@ int32_t ec_manager_link(ec_fop_data_t * fop, int32_t state) { case EC_STATE_INIT: case EC_STATE_LOCK: - ec_lock_prepare_parent_inode(fop, &fop->loc[1], EC_UPDATE_DATA | - EC_UPDATE_META | - EC_INODE_SIZE); + ec_lock_prepare_parent_inode(fop, &fop->loc[1], &fop->loc[0], + EC_UPDATE_DATA | EC_UPDATE_META | + EC_INODE_SIZE); ec_lock(fop); return EC_STATE_DISPATCH; @@ -541,7 +541,7 @@ int32_t ec_manager_mkdir(ec_fop_data_t * fop, int32_t state) /* Fall through */ case EC_STATE_LOCK: - ec_lock_prepare_parent_inode(fop, &fop->loc[0], + ec_lock_prepare_parent_inode(fop, &fop->loc[0], NULL, EC_UPDATE_DATA | EC_UPDATE_META); ec_lock(fop); @@ -747,7 +747,7 @@ int32_t ec_manager_mknod(ec_fop_data_t * fop, int32_t state) /* Fall through */ case EC_STATE_LOCK: - ec_lock_prepare_parent_inode(fop, &fop->loc[0], + ec_lock_prepare_parent_inode(fop, &fop->loc[0], NULL, EC_UPDATE_DATA | EC_UPDATE_META); ec_lock(fop); @@ -906,10 +906,10 @@ int32_t ec_manager_rename(ec_fop_data_t * fop, int32_t state) { case EC_STATE_INIT: case EC_STATE_LOCK: - ec_lock_prepare_parent_inode(fop, &fop->loc[0], EC_UPDATE_DATA | - EC_UPDATE_META | - EC_INODE_SIZE); - ec_lock_prepare_parent_inode(fop, &fop->loc[1], + ec_lock_prepare_parent_inode(fop, &fop->loc[0], &fop->loc[0], + EC_UPDATE_DATA | EC_UPDATE_META | + EC_INODE_SIZE); + ec_lock_prepare_parent_inode(fop, &fop->loc[1], NULL, EC_UPDATE_DATA | EC_UPDATE_META); ec_lock(fop); @@ -1068,7 +1068,7 @@ int32_t ec_manager_rmdir(ec_fop_data_t * fop, int32_t state) { case EC_STATE_INIT: case EC_STATE_LOCK: - ec_lock_prepare_parent_inode(fop, &fop->loc[0], + ec_lock_prepare_parent_inode(fop, &fop->loc[0], NULL, EC_UPDATE_DATA | EC_UPDATE_META); ec_lock(fop); @@ -1214,7 +1214,7 @@ int32_t ec_manager_symlink(ec_fop_data_t * fop, int32_t state) { case EC_STATE_INIT: case EC_STATE_LOCK: - ec_lock_prepare_parent_inode(fop, &fop->loc[0], + ec_lock_prepare_parent_inode(fop, &fop->loc[0], NULL, EC_UPDATE_DATA | EC_UPDATE_META); ec_lock(fop); @@ -1380,7 +1380,7 @@ int32_t ec_manager_unlink(ec_fop_data_t * fop, int32_t state) { case EC_STATE_INIT: case EC_STATE_LOCK: - ec_lock_prepare_parent_inode(fop, &fop->loc[0], + ec_lock_prepare_parent_inode(fop, &fop->loc[0], NULL, EC_UPDATE_DATA | EC_UPDATE_META); ec_lock(fop); |