diff options
author | Krutika Dhananjay <kdhananj@redhat.com> | 2015-01-22 17:02:20 +0530 |
---|---|---|
committer | Niels de Vos <ndevos@redhat.com> | 2015-02-05 06:52:45 -0800 |
commit | bb2df4e63fa8a5d65f18b4a5efc757e8d475fbff (patch) | |
tree | 06dcfb75c7c12fec9c4458b1f14c5dbd29d48adb /xlators/cluster/afr/src/afr-dir-read.c | |
parent | c0419befa9d0d470a921863cd700d778ce5da194 (diff) |
cluster/afr: When parent and entry read subvols are different, set entry->inode to NULL
Backport of: http://review.gluster.org/#/c/9477
That way a lookup would be forced on the entry, and its attributes will
always be selected from its read subvol.
Additionally, directory write fops as well as LOOKUP have been made to
unwind parent attributes from parent's read child in AFR.
Change-Id: I9fca49fa91cc3a65f53db855fedb90b08f1ca7f4
BUG: 1186121
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: http://review.gluster.org/9504
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Tested-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-dir-read.c')
-rw-r--r-- | xlators/cluster/afr/src/afr-dir-read.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-dir-read.c b/xlators/cluster/afr/src/afr-dir-read.c index 689dd84e646..d94cb0ca699 100644 --- a/xlators/cluster/afr/src/afr-dir-read.c +++ b/xlators/cluster/afr/src/afr-dir-read.c @@ -422,14 +422,32 @@ afr_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, dict_t *xdata) { - afr_local_t *local = NULL; + afr_local_t *local = NULL; + gf_dirent_t *entry = NULL; + int par_read_child = (long) cookie; + int32_t read_child = -1; if (op_ret == -1) goto out; local = frame->local; + afr_readdir_filter_trash_dir (entries, local->fd); + list_for_each_entry (entry, &entries->list, list) { + if (entry->inode) { + read_child = -1; + + read_child = afr_inode_get_read_ctx (this, entry->inode, + NULL); + if (read_child != par_read_child) { + inode_unref (entry->inode); + entry->inode = NULL; + continue; + } + } + } + out: AFR_STACK_UNWIND (readdirp, frame, op_ret, op_errno, entries, NULL); return 0; |