Skip to content

Commit

Permalink
Version 6.2.0.187
Browse files Browse the repository at this point in the history
Note: This is a pre-release version, future versions of VDO may not support
VDO devices created with this version.
- Fixed a potential deadlock in the UDS index by using the kernel supplied
  struct callback instead of our own implementation of synchronous
  callbacks.
- Eliminated obsolete code and fields from UDS.
- Converted the VDO module to use numeric.h from the UDS module instead of
  having its own version.
- Fixed a bug which would cause incorrect encoding of VDO data structures
  on disk.
- Removed or modified logging which prints pointers from the kernel since
  newer kernels obfuscate the pointer values for security reasons.
- Eliminated confusing and spurious error messages when rebuilding a UDS
  index.
- Improved memory allocation by not using the incorrect __GFP_NORETRY flag
  and by using the memalloc_noio_save mechanism.
- Finished conversion of the encoding and decoding of the VDO's on-disk
  structures to be platform independent.
- Converted VDO to use the atomic API from the UDS module instead of its
  own.
- Fixed memory leaks in UDS error paths.
- Fixed a potential stack overflow when reaping the recovery journal.
  • Loading branch information
corwin committed Jul 27, 2018
1 parent 0a646e3 commit 3e6311a
Show file tree
Hide file tree
Showing 71 changed files with 2,056 additions and 2,613 deletions.
6 changes: 3 additions & 3 deletions kvdo.spec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
%define spec_release 1
%define kmod_name kvdo
%define kmod_driver_version 6.2.0.132
%define kmod_driver_version 6.2.0.187
%define kmod_rpm_release %{spec_release}
%define kmod_kernel_version 3.10.0-693.el7

Expand Down Expand Up @@ -85,5 +85,5 @@ rm -rf $RPM_BUILD_ROOT
%{_usr}/src/%{kmod_name}-%{version}-%{kmod_driver_version}/*

%changelog
* Wed Jun 27 2018 - J. corwin Coburn <[email protected]> - 6.2.0.132-1
HASH(0x1bcd770)
* Fri Jul 27 2018 - J. corwin Coburn <[email protected]> - 6.2.0.187-1
HASH(0x229f768)
2 changes: 1 addition & 1 deletion uds/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
UDS_VERSION = 6.2.0.48
UDS_VERSION = 6.2.0.63

SOURCES = $(notdir $(wildcard $(src)/*.c)) murmur/MurmurHash3.c
SOURCES += $(addprefix util/,$(notdir $(wildcard $(src)/util/*.c)))
Expand Down
3 changes: 1 addition & 2 deletions uds/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* $Id: //eng/uds-releases/gloria/src/uds/buffer.c#3 $
* $Id: //eng/uds-releases/gloria/src/uds/buffer.c#4 $
*/

#include "buffer.h"
Expand Down Expand Up @@ -319,7 +319,6 @@ int putBuffer(Buffer *target, Buffer *source, size_t length)
}

source->start += length;
target->end += length;
return UDS_SUCCESS;
}

Expand Down
79 changes: 37 additions & 42 deletions uds/index.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* $Id: //eng/uds-releases/gloria/src/uds/index.c#7 $
* $Id: //eng/uds-releases/gloria/src/uds/index.c#8 $
*/

#include "index.h"
Expand Down Expand Up @@ -50,20 +50,18 @@ static int replayIndexFromCheckpoint(Index *index,
index->volume->lookupMode = oldLookupMode;
if (result != UDS_SUCCESS) {
return logFatalWithStringError(result,
"index_%u: cannot replay index: "
"unknown volume chapter boundaries",
index->id);
"cannot replay index: "
"unknown volume chapter boundaries");
}
if (lowestVCN > highestVCN) {
logFatal("index_%u: cannot replay index: no valid chapters exist",
index->id);
logFatal("cannot replay index: no valid chapters exist");
return UDS_CORRUPT_COMPONENT;
}

if (isEmpty) {
// The volume is empty, so the index should also be empty
if (index->newestVirtualChapter != 0) {
logFatal("index_%u: cannot replay index from empty volume", index->id);
logFatal("cannot replay index from empty volume");
return UDS_CORRUPT_COMPONENT;
}
return UDS_SUCCESS;
Expand Down Expand Up @@ -104,9 +102,8 @@ static int loadIndex(Index *index, bool allowReplay)
= ((index->lastCheckpoint != NO_LAST_CHECKPOINT)
? index->lastCheckpoint : 0);

logInfo("index_%u: loaded index from chapter %" PRIu64 " through chapter %"
PRIu64,
index->id, index->oldestVirtualChapter, lastCheckpointChapter);
logInfo("loaded index from chapter %" PRIu64 " through chapter %" PRIu64,
index->oldestVirtualChapter, lastCheckpointChapter);

if (replayRequired) {
result = replayIndexFromCheckpoint(index, lastCheckpointChapter);
Expand Down Expand Up @@ -135,13 +132,11 @@ static int rebuildIndex(Index *index)
index->volume->lookupMode = oldLookupMode;
if (result != UDS_SUCCESS) {
return logFatalWithStringError(result,
"index_%u: cannot rebuild index: "
"unknown volume chapter boundaries",
index->id);
"cannot rebuild index: "
"unknown volume chapter boundaries");
}
if (lowestVCN > highestVCN) {
logFatal("index_%u: cannot rebuild index: no valid chapters exist",
index->id);
logFatal("cannot rebuild index: no valid chapters exist");
return UDS_CORRUPT_COMPONENT;
}

Expand All @@ -161,9 +156,8 @@ static int rebuildIndex(Index *index)
if ((index->newestVirtualChapter - index->oldestVirtualChapter) >
index->volume->geometry->chaptersPerVolume) {
return logFatalWithStringError(UDS_CORRUPT_COMPONENT,
"index_%u: cannot rebuild index: "
"volume chapter boundaries too large",
index->id);
"cannot rebuild index: "
"volume chapter boundaries too large");
}

setMasterIndexOpenChapter(index->masterIndex, 0);
Expand Down Expand Up @@ -271,14 +265,14 @@ static int saveIndexComponents(Index *index)
{
int result = finishCheckpointing(index);
if (result != UDS_SUCCESS) {
logInfo("index_%u: save failed", index->id);
logInfo("save index failed");
return result;
}
beginSave(index, false, index->newestVirtualChapter);

result = saveIndexState(index->state);
if (result != UDS_SUCCESS) {
logInfo("index_%u: save failed", index->id);
logInfo("save index failed");
index->lastCheckpoint = index->prevCheckpoint;
}

Expand Down Expand Up @@ -549,19 +543,18 @@ static int dispatchIndexZoneRequest(IndexZone *zone, Request *request)
case REQUEST_UPDATE:
case REQUEST_QUERY:
result = searchIndexZone(zone, request);
result = logUnrecoverable(result, "index_%u: searchLockedIndex() failed",
zone->index->id);
result = logUnrecoverable(result, "searchIndexZone() failed");
break;

case REQUEST_DELETE:
result = removeFromIndexZone(zone, request);
result = logUnrecoverable(result, "index_%u: removeFromIndexZone() failed",
zone->index->id);
result = logUnrecoverable(result, "removeFromIndexZone() failed");
break;

default:
result = logWarningWithStringError(UDS_INVALID_ARGUMENT,
"attempted to execute invalid action: %d",
"attempted to execute invalid action:"
" %d",
request->action);
}

Expand All @@ -587,18 +580,19 @@ static int rebuildIndexPageMap(Index *index, uint64_t vcn)
CACHE_PROBE_INDEX_FIRST, NULL, &chapterIndexPage);
if (result != UDS_SUCCESS) {
return logErrorWithStringError(result,
"index_%u: Failed to read "
"index page %u in chapter %u",
index->id, indexPageNumber, chapter);
"failed to read index page %u"
" in chapter %u",
indexPageNumber, chapter);
}
unsigned int highestDeltaList
= getChapterIndexHighestListNumber(chapterIndexPage);
result = updateIndexPageMap(index->volume->indexPageMap, vcn, chapter,
indexPageNumber, highestDeltaList);
if (result != UDS_SUCCESS) {
return logErrorWithStringError(
result, "index_%u: failed to update chapter %u index page %u",
index->id, chapter, indexPageNumber);
return logErrorWithStringError(result,
"failed to update chapter %u index page"
" %u",
chapter, indexPageNumber);
}
}
return UDS_SUCCESS;
Expand Down Expand Up @@ -706,8 +700,7 @@ void beginSave(Index *index, bool checkpoint, uint64_t openChapterNumber)
: openChapterNumber - 1);

const char *what = (checkpoint ? "checkpoint" : "save");
logInfo("index_%u: beginning %s (vcn %"PRIu64")",
index->id, what, index->lastCheckpoint);
logInfo("beginning %s (vcn %" PRIu64 ")", what, index->lastCheckpoint);

}

Expand All @@ -716,8 +709,9 @@ int replayVolume(Index *index, uint64_t fromVCN)
{
int result;
uint64_t uptoVCN = index->newestVirtualChapter;
logInfo("index_%u: Replaying volume from chapter %"PRIu64
" through chapter %"PRIu64, index->id, fromVCN, uptoVCN);
logInfo("Replaying volume from chapter %" PRIu64 " through chapter %"
PRIu64,
fromVCN, uptoVCN);
setMasterIndexOpenChapter(index->masterIndex, uptoVCN);
setMasterIndexOpenChapter(index->masterIndex, fromVCN);

Expand Down Expand Up @@ -750,9 +744,10 @@ int replayVolume(Index *index, uint64_t fromVCN)
result = rebuildIndexPageMap(index, vcn);
if (result != UDS_SUCCESS) {
index->volume->lookupMode = oldLookupMode;
return logErrorWithStringError(
result, "index_%u: could not rebuild index page map for chapter %u",
index->id, chapter);
return logErrorWithStringError(result,
"could not rebuild index page map for"
" chapter %u",
chapter);
}

for (unsigned int j = 0; j < geometry->recordPagesPerChapter; j++) {
Expand All @@ -762,8 +757,8 @@ int replayVolume(Index *index, uint64_t fromVCN)
CACHE_PROBE_RECORD_FIRST, &recordPage, NULL);
if (result != UDS_SUCCESS) {
index->volume->lookupMode = oldLookupMode;
return logUnrecoverable(result, "index_%u: could not get page %d",
index->id, recordPageNumber);
return logUnrecoverable(result, "could not get page %d",
recordPageNumber);
}
for (unsigned int k = 0; k < geometry->recordsPerPage; k++) {
const byte *nameBytes = recordPage + (k * BYTES_PER_RECORD);
Expand All @@ -778,9 +773,9 @@ int replayVolume(Index *index, uint64_t fromVCN)
strncpy(hexName, "<unknown>", sizeof(hexName));
}
index->volume->lookupMode = oldLookupMode;
return logUnrecoverable(result, "index_%u: "
return logUnrecoverable(result,
"could not find block %s during rebuild",
index->id, hexName);
hexName);
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions uds/index.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* $Id: //eng/uds-releases/gloria/src/uds/index.h#3 $
* $Id: //eng/uds-releases/gloria/src/uds/index.h#4 $
*/

#ifndef INDEX_H
Expand All @@ -36,7 +36,6 @@
typedef struct indexCheckpoint IndexCheckpoint;

typedef struct index {
unsigned int id;
bool existed;
IndexLayout *layout;
IndexState *state;
Expand Down
40 changes: 13 additions & 27 deletions uds/indexCheckpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*
* $Id: //eng/uds-releases/gloria/src/uds/indexCheckpoint.c#1 $
* $Id: //eng/uds-releases/gloria/src/uds/indexCheckpoint.c#2 $
*/

#include "indexCheckpoint.h"
Expand Down Expand Up @@ -203,7 +203,7 @@ int processChapterWriterCheckpointSaves(Index *index)

if (result != UDS_SUCCESS) {
checkpoint->state = CHECKPOINT_ABORTING;
logInfo("index_%u: checkpoint failed", index->id);
logInfo("checkpoint failed");
index->lastCheckpoint = index->prevCheckpoint;
}
}
Expand All @@ -224,7 +224,7 @@ static int abortCheckpointing(Index *index, int result)
{
if (index->checkpoint->state != NOT_CHECKPOINTING) {
index->checkpoint->state = CHECKPOINT_ABORTING;
logInfo("index_%u: checkpoint failed", index->id);
logInfo("checkpoint failed");
index->lastCheckpoint = index->prevCheckpoint;
}
return result;
Expand Down Expand Up @@ -282,9 +282,7 @@ static int doCheckpointStart(Index *index, unsigned int zone)
beginSave(index, true, checkpoint->chapter);
int result = startIndexStateCheckpoint(index->state);
if (result != UDS_SUCCESS) {
logErrorWithStringError(result,
"index_%u: cannot start index checkpoint",
index->id);
logErrorWithStringError(result, "cannot start index checkpoint");
index->lastCheckpoint = index->prevCheckpoint;
unlockMutex(&checkpoint->mutex);
return result;
Expand All @@ -305,21 +303,17 @@ static int doCheckpointProcess(Index *index, unsigned int zone)
int result = performIndexStateCheckpointInZone(index->state, zone, &status);
if (result != UDS_SUCCESS) {
lockMutex(&checkpoint->mutex);
logErrorWithStringError(result,
"index_%u: cannot continue index checkpoint",
index->id);
logErrorWithStringError(result, "cannot continue index checkpoint");
result = abortCheckpointing(index, result);
unlockMutex(&checkpoint->mutex);
} else if (status == CS_JUST_COMPLETED) {
lockMutex(&checkpoint->mutex);
if (--checkpoint->zonesBusy == 0) {
checkpoint->checkpoints += 1;
logInfo("index_%u: finished checkpoint", index->id);
logInfo("finished checkpoint");
result = finishIndexStateCheckpoint(index->state);
if (result != UDS_SUCCESS) {
logErrorWithStringError(result,
"index_%u: (%s) checkpoint finish failed",
index->id,
logErrorWithStringError(result, "%s checkpoint finish failed",
__func__);
}
checkpoint->state = NOT_CHECKPOINTING;
Expand All @@ -336,17 +330,13 @@ static int doCheckpointAbort(Index *index, unsigned int zone)
CompletionStatus status = CS_NOT_COMPLETED;
int result = abortIndexStateCheckpointInZone(index->state, zone, &status);
if (result != UDS_SUCCESS) {
logErrorWithStringError(result,
"index_%u: cannot abort index checkpoint",
index->id);
logErrorWithStringError(result, "cannot abort index checkpoint");
} else if (status == CS_JUST_COMPLETED) {
if (--checkpoint->zonesBusy == 0) {
logInfo("index_%u: aborted checkpoint", index->id);
logInfo("aborted checkpoint");
result = abortIndexStateCheckpoint(index->state);
if (result != UDS_SUCCESS) {
logErrorWithStringError(result,
"index_%u: checkpoint abort failed",
index->id);
logErrorWithStringError(result, "checkpoint abort failed");
}
checkpoint->state = NOT_CHECKPOINTING;
}
Expand All @@ -364,22 +354,18 @@ static int doCheckpointFinish(Index *index, unsigned int zone)
unlockMutex(&checkpoint->mutex);
int result = finishIndexStateCheckpointInZone(index->state, zone, &status);
if (result != UDS_SUCCESS) {
logErrorWithStringError(result,
"index_%u: cannot finish index checkpoint",
index->id);
logErrorWithStringError(result, "cannot finish index checkpoint");
lockMutex(&checkpoint->mutex);
result = abortCheckpointing(index, result);
unlockMutex(&checkpoint->mutex);
} else if (status == CS_JUST_COMPLETED) {
lockMutex(&checkpoint->mutex);
if (--checkpoint->zonesBusy == 0) {
checkpoint->checkpoints += 1;
logInfo("index_%u: finished checkpoint", index->id);
logInfo("finished checkpoint");
result = finishIndexStateCheckpoint(index->state);
if (result != UDS_SUCCESS) {
logErrorWithStringError(result,
"index_%u: (%s) checkpoint finish failed",
index->id,
logErrorWithStringError(result, "%s checkpoint finish failed",
__func__);
}
checkpoint->state = NOT_CHECKPOINTING;
Expand Down
Loading

0 comments on commit 3e6311a

Please sign in to comment.