Commit d12e4422 authored by Phoebe Buckheister's avatar Phoebe Buckheister 🦎 Committed by Bernd Lietzow

client: don't fsync targets that are not poffline/good

bad targets needn't be synced because they are effectively dead to the
system until the admin intervenes. nedds-resync targets are much the
same - any sync we do will be overwritten by resync. offline targets
are offline, so no communication should happen at all. this leaves only
poffline/good targets for fsync, which is exactly what we want: if the
target does come back, we did nothing wrong, and if it truly goes away,
we will just feign success.

(cherry picked from commit dc66f25e67a36d56c89dfbfb77790266871ea2fa)

* see #634
parent 132fe3f9
......@@ -1316,12 +1316,21 @@ void FhgfsOpsCommKit_writefileV2bCommunicate(App* app, RemotingIOInfo* ioInfo,
static enum CKTargetBadAction __commkit_fsync_selectedTargetBad(CommKitContext* context,
struct CommKitTargetInfo* info, const CombinedTargetState* targetState)
{
if(targetState->consistencyState != TargetConsistencyState_BAD)
return CK_CONTINUE_TARGET;
if(StripePattern_getPatternType(context->ioInfo->pattern) == STRIPEPATTERN_BuddyMirror &&
// we must not try to fsync a secondary that is currently offline, but we should fsync
// secondaries that are needs-resync (because a resync might be running, but our file was already
// resynced). we will also try to fsync a secondary that is poffline, just in case it comes back
// to online.
// bad targets should be silently ignored just like offline targets because they might do
// who-knows-what with our request and produce spurious errors.
if (StripePattern_getPatternType(context->ioInfo->pattern) == STRIPEPATTERN_BuddyMirror &&
info->useBuddyMirrorSecond)
info->nodeResult = -FhgfsOpsErr_SUCCESS;
{
if (targetState->reachabilityState == TargetReachabilityState_OFFLINE ||
targetState->consistencyState == TargetConsistencyState_BAD)
info->nodeResult = -FhgfsOpsErr_SUCCESS;
else if (targetState->consistencyState == TargetConsistencyState_NEEDS_RESYNC)
return CK_CONTINUE_TARGET;
}
return CK_SKIP_TARGET;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment