diff options
| author | Venkatesh Somyajulu <vsomyaju@redhat.com> | 2014-09-10 22:18:34 +0530 | 
|---|---|---|
| committer | Niels de Vos <ndevos@redhat.com> | 2014-09-17 08:34:33 -0700 | 
| commit | 3f3e57cef2cd11f336a6d6496de37c89a3e90789 (patch) | |
| tree | 460e20eb4c34a7ca89aabbc1e284135d932aeff9 /xlators/cluster/dht/src/dht-common.h | |
| parent | c0cc62c144c560dcbfe9c89a139f51fd5274e33f (diff) | |
cluster/dht: Fix races to avoid deletion of linkto file
Explanation of Race between rebalance processes:
https://bugzilla.redhat.com/show_bug.cgi?id=1110694#c4
STATE 1:                          BRICK-1
only one brick                   Cached File
in the system
STATE 2:
Add brick-2                       BRICK-1                BRICK-2
STATE 3:                                       Lookup of File on brick-2
                                               by this node's rebalance
                                               will fail because hashed
                                               file is not created yet.
                                               So dht_lookup_everywhere is
                                               about to get called.
STATE 4:                         As part of lookup
                                 link file at brick-2
                                 will be created.
STATE 5:                         getxattr to check that
                                 cached file belongs to
                                 this node is done
STATE 6:
                                            dht_lookup_everywhere_cbk detects
                                            the link created by rebalance-1.
                                            It will unlink it.
STATE 7:                        getxattr at the link
                                file with "pathinfo" key
                                will be called will fail
                                as the link file is deleted
                                by rebalance on node-2
Fix:
So in the STATE 6, we should avoid the deletion of link file. Every time
dht_lookup_everywhere gets called, lookup will be performed on all the nodes.
So to avoid STATE 6, if linkto file is found, it is not deleted until valid
case is found in dht_lookup_everywhere_done.
Case 1: if linkto file points to cached node, and cached file exists,
        uwind with success.
Case 2: if linkto does not point to current cached node, and cached file
        exists:
        a) Unlink stale link file
        b) Create new link file
Case 3: Only linkto file exists:
        Delete linkto file
Case 4: Only cached file
        Create link file (Handled event without patch)
Case 5: Neither cached nor hashed file is present
        Return with ENOENT (handled even without patch)
Change-Id: Ibf53671410d8d613b8e2e7e5d0ec30fc7dcc0298
BUG: 1129541
Signed-off-by: Venkatesh Somyajulu <vsomyaju@redhat.com>
Reviewed-on: http://review.gluster.org/8231
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Tested-by: Vijay Bellur <vbellur@redhat.com>
(cherry picked from commit 74d92e322e3c9f4f70ddfbf9b0e2140922009658)
Signed-off-by: Nithya Balachandran <nbalacha@redhat.com>
Reviewed-on: http://review.gluster.org/8717
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Diffstat (limited to 'xlators/cluster/dht/src/dht-common.h')
| -rw-r--r-- | xlators/cluster/dht/src/dht-common.h | 17 | 
1 files changed, 17 insertions, 0 deletions
diff --git a/xlators/cluster/dht/src/dht-common.h b/xlators/cluster/dht/src/dht-common.h index dc23bfa7f0c..bc7ee19e241 100644 --- a/xlators/cluster/dht/src/dht-common.h +++ b/xlators/cluster/dht/src/dht-common.h @@ -99,6 +99,17 @@ struct dht_rebalance_ {          dict_t              *xdata;  }; + +struct dht_skip_linkto_unlink { + +        gf_boolean_t    handle_valid_link; +        int             opend_fd_count; +        xlator_t        *hash_links_to; +        uuid_t          cached_gfid; +        uuid_t          hashed_gfid; +}; + +  struct dht_local {          int                      call_cnt;          loc_t                    loc; @@ -187,6 +198,9 @@ struct dht_local {          xlator_t        *first_up_subvol;          gf_boolean_t     added_link; + +        struct dht_skip_linkto_unlink  skip_unlink; +  };  typedef struct dht_local dht_local_t; @@ -787,4 +801,7 @@ dht_inode_ctx_get1 (xlator_t *this, inode_t *inode, xlator_t **subvol);  int  dht_subvol_status (dht_conf_t *conf, xlator_t *subvol); +int +dht_lookup_everywhere_done (call_frame_t *frame, xlator_t *this); +  #endif/* _DHT_H */  | 
