cluster/afr: Add gfid to index in wind un-conditionally
Problem: If brick crashes just after performing xattrop before reaching index _cbk then the gfid will not be added to/deleted from index. If it is not deleted it will be deleted when self-heal is triggered. But if the crash happens before the file is added to index, user may think the system does not need self-heal even when there is this file that needs to be healed. Fix: Add file to index un-conditionally in wind phase. This way the file remains in index even when brick process crashes before reaching _cbk. This does not affect performance because of caching(check _index_action) built into index xlator. Change-Id: Ie83ac6aa1ac0ff66862e757864865b47ab39404d BUG: 1058713 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/6836 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Anand Avati <avati@redhat.com>
This commit is contained in:
parent
410fe979b4
commit
922134fdc0
@ -655,22 +655,16 @@ _check_key_is_zero_filled (dict_t *d, char *k, data_t *v,
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
_xattrop_index_action (xlator_t *this, inode_t *inode, dict_t *xattr)
|
||||
_index_action (xlator_t *this, inode_t *inode, gf_boolean_t zero_xattr)
|
||||
{
|
||||
gf_boolean_t zero_xattr = _gf_true;
|
||||
int ret = 0;
|
||||
index_inode_ctx_t *ctx = NULL;
|
||||
int ret = 0;
|
||||
|
||||
ret = dict_foreach (xattr, _check_key_is_zero_filled, NULL);
|
||||
if (ret == -1)
|
||||
zero_xattr = _gf_false;
|
||||
|
||||
ret = index_inode_ctx_get (inode, this, &ctx);
|
||||
if (ret) {
|
||||
gf_log (this->name, GF_LOG_ERROR, "Not able to %s %s -> index",
|
||||
zero_xattr?"add":"del", uuid_utoa (inode->gfid));
|
||||
zero_xattr?"del":"add", uuid_utoa (inode->gfid));
|
||||
goto out;
|
||||
}
|
||||
if (zero_xattr) {
|
||||
@ -690,6 +684,19 @@ out:
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
_xattrop_index_action (xlator_t *this, inode_t *inode, dict_t *xattr)
|
||||
{
|
||||
gf_boolean_t zero_xattr = _gf_true;
|
||||
int ret = 0;
|
||||
|
||||
ret = dict_foreach (xattr, _check_key_is_zero_filled, NULL);
|
||||
if (ret == -1)
|
||||
zero_xattr = _gf_false;
|
||||
_index_action (this, inode, zero_xattr);
|
||||
return;
|
||||
}
|
||||
|
||||
void
|
||||
fop_xattrop_index_action (xlator_t *this, inode_t *inode, dict_t *xattr)
|
||||
{
|
||||
@ -868,6 +875,11 @@ int
|
||||
index_xattrop_wrapper (call_frame_t *frame, xlator_t *this, loc_t *loc,
|
||||
gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata)
|
||||
{
|
||||
//In wind phase bring the gfid into index. This way if the brick crashes
|
||||
//just after posix performs xattrop before _cbk reaches index xlator
|
||||
//we will still have the gfid in index.
|
||||
_index_action (this, frame->local, _gf_false);
|
||||
|
||||
STACK_WIND (frame, index_xattrop_cbk, FIRST_CHILD (this),
|
||||
FIRST_CHILD (this)->fops->xattrop, loc, optype, xattr,
|
||||
xdata);
|
||||
@ -878,6 +890,10 @@ int
|
||||
index_fxattrop_wrapper (call_frame_t *frame, xlator_t *this, fd_t *fd,
|
||||
gf_xattrop_flags_t optype, dict_t *xattr, dict_t *xdata)
|
||||
{
|
||||
//In wind phase bring the gfid into index. This way if the brick crashes
|
||||
//just after posix performs xattrop before _cbk reaches index xlator
|
||||
//we will still have the gfid in index.
|
||||
_index_action (this, frame->local, _gf_false);
|
||||
STACK_WIND (frame, index_fxattrop_cbk, FIRST_CHILD (this),
|
||||
FIRST_CHILD (this)->fops->fxattrop, fd, optype, xattr,
|
||||
xdata);
|
||||
|
Loading…
x
Reference in New Issue
Block a user