diff options
| author | Pranith Kumar K <pkarampu@redhat.com> | 2014-01-28 15:16:59 +0530 | 
|---|---|---|
| committer | Anand Avati <avati@redhat.com> | 2014-01-29 19:42:24 -0800 | 
| commit | 922134fdc08afb2810cb0205f26693d36db6fd4e (patch) | |
| tree | 362907e5faa1f18b4ad67edc91d69922a04422fc /xlators/features/index/src/index.c | |
| parent | 410fe979b4e2492f04e9cc8949f5ef5041e1135a (diff) | |
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>
Diffstat (limited to 'xlators/features/index/src/index.c')
| -rw-r--r-- | xlators/features/index/src/index.c | 34 | 
1 files changed, 25 insertions, 9 deletions
diff --git a/xlators/features/index/src/index.c b/xlators/features/index/src/index.c index db592719b57..ce037aa244b 100644 --- a/xlators/features/index/src/index.c +++ b/xlators/features/index/src/index.c @@ -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) { @@ -691,6 +685,19 @@ out:  }  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)  {          _xattrop_index_action (this, inode, 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);  | 
