Add a workaround for device not ready error.

In rare cases after moving file system to a new location file system check
fails on the first try. As a temporary workaround, wait a bit and try again.
This commit is contained in:
Andrius Štikonas 2017-10-30 15:44:31 +00:00
parent bbfff249cb
commit 8909dd87d0
1 changed files with 12 additions and 0 deletions

View File

@ -24,6 +24,9 @@
#include "util/report.h"
#include <QDebug>
#include <QThread>
#include <KLocalizedString>
/** Creates a new CheckFileSystemJob
@ -45,6 +48,15 @@ bool CheckFileSystemJob::run(Report& parent)
if (partition().fileSystem().supportCheck() == FileSystem::cmdSupportFileSystem)
rval = partition().fileSystem().check(*report, partition().deviceNode());
// HACK
// In rare cases after moving file system to a new location file system check
// fails on the first try. As a temporary workaround, wait a bit and try again.
if (!rval) {
QThread::sleep(2);
qDebug() << "Partition might not be ready yet. Retrying...";
rval = partition().fileSystem().check(*report, partition().deviceNode());
}
jobFinished(*report, rval);
return rval;