diff options
| author | Richard Wareing <rwareing@fb.com> | 2015-09-25 19:35:10 -0700 |
|---|---|---|
| committer | Jeff Darcy <jeff@pl.atyp.us> | 2017-07-07 19:15:01 +0000 |
| commit | 24d3099681c4fbeb4c9d868ee58810548335833a (patch) | |
| tree | 99c36ad145c8fcf7ce5e3ab24c33e23e1de89de3 | |
| parent | 3fcf536f4983fc8a3da7c5204f3dd9b75259a7a8 (diff) | |
cluster/afr: Adjust gfid unsplit flow for proper correctness w/ AFR2
Summary:
- Prior patch did not re-run the gfid-mismatch flow after doing the
unsplit. I think this is prudent to re-validate the unsplit worked as
well as allow the code to continue from where it effectively left off.
Test Plan: - Run prove -v tests/basic/gfid_unsplit.t
Reviewers: dph, moox, sshreyas
Reviewed By: sshreyas
Change-Id: Ib3ed40f3db38c89090a876d7af3a1b2a303539d5
Signed-off-by: Jeff Darcy <jdarcy@fb.com>
Reviewed-on: https://review.gluster.org/17729
Smoke: Gluster Build System <jenkins@build.gluster.org>
Tested-by: Jeff Darcy <jeff@pl.atyp.us>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
| -rw-r--r-- | tests/basic/gfid_unsplit.t | 4 | ||||
| -rw-r--r-- | tests/include.rc | 3 | ||||
| -rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-name.c | 25 |
3 files changed, 24 insertions, 8 deletions
diff --git a/tests/basic/gfid_unsplit.t b/tests/basic/gfid_unsplit.t index 9bb52f4533a..3fe7a6f140c 100644 --- a/tests/basic/gfid_unsplit.t +++ b/tests/basic/gfid_unsplit.t @@ -2,6 +2,7 @@ . $(dirname $0)/../include.rc . $(dirname $0)/../volume.rc +. $(dirname $0)/../nfs.rc cleanup; @@ -63,7 +64,8 @@ TEST [ "$MD5" == "$HEALED_MD5" ] TEST rm -f $M0/splitfile # Part II: NFS test -TEST mount -t nfs -o nolock,noatime,noacl,soft,intr $H0:/$V0 $N0; +TEST mount_nfs $H0:/$V0 $N0 nolock +#EST mount -t nfs -o nolock,noatime,noacl,soft,intr $H0:/$V0 $N0; dd if=/dev/urandom of=$N0/splitfile bs=128k count=5 2>/dev/null diff --git a/tests/include.rc b/tests/include.rc index 872aec11edf..8b6504e6c58 100644 --- a/tests/include.rc +++ b/tests/include.rc @@ -426,6 +426,7 @@ stat -c %s /dev/null > /dev/null 2>&1 || { function cleanup() { + local OLDPWD=$PWD cd # Things go pear-shaped if we're inside a Gluster mount. # Prepare flags for umount @@ -578,6 +579,8 @@ function cleanup() # above to fail, promoting that into a failure of the whole test (and # thus of an entire regression-test run) seems a bit excessive. Make # sure we return good status anyway. + + cd $OLDPWD return 0 } diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c index deb3b4e59af..bf34215ba1f 100644 --- a/xlators/cluster/afr/src/afr-self-heal-name.c +++ b/xlators/cluster/afr/src/afr-self-heal-name.c @@ -689,6 +689,7 @@ __afr_selfheal_name_do (call_frame_t *frame, xlator_t *this, inode_t *parent, gf_boolean_t source_is_empty = _gf_true; gf_boolean_t need_heal = _gf_false; gf_boolean_t is_gfid_absent = _gf_false; + gf_boolean_t tried_gfid_unsplit = _gf_false; need_heal = afr_selfheal_name_need_heal_check (this, replies); if (!need_heal) @@ -710,7 +711,15 @@ __afr_selfheal_name_do (call_frame_t *frame, xlator_t *this, inode_t *parent, if (ret) return ret; - if (gfid_idx == -1) { +gfid_mismatch_check: + ret = afr_selfheal_name_gfid_mismatch_check (this, replies, source, + sources, &gfid_idx, + pargfid, bname); + + if (ret && tried_gfid_unsplit == _gf_true) + return ret; + + if (gfid_idx == -1) { if (!gfid_req || gf_uuid_is_null (gfid_req)) return -1; gfid = gfid_req; @@ -718,14 +727,16 @@ __afr_selfheal_name_do (call_frame_t *frame, xlator_t *this, inode_t *parent, gfid = &replies[gfid_idx].poststat.ia_gfid; } - ret = afr_selfheal_name_gfid_mismatch_check (this, replies, source, - sources, &gfid_idx, - pargfid, bname); - if (ret) + if (ret && tried_gfid_unsplit == _gf_false) { ret = __afr_selfheal_gfid_unsplit (this, parent, pargfid, bname, inode, replies, gfid, locked_on); - if (ret) - return ret; + + if (ret) + return ret; + + tried_gfid_unsplit = _gf_true; + goto gfid_mismatch_check; + } is_gfid_absent = (gfid_idx == -1) ? _gf_true : _gf_false; ret = __afr_selfheal_assign_gfid (this, parent, pargfid, bname, inode, |
