lib/nfs/FileReader: update "state" in OnNfsError()
Clean up the "state" to indicate that there is no longer any asynchronous operation. Fixes another NFS-related crash due to cleanup of a non-existing asynchronous operation.
This commit is contained in:
@@ -246,6 +246,30 @@ NfsFileReader::OnNfsCallback(unsigned status, void *data)
|
|||||||
void
|
void
|
||||||
NfsFileReader::OnNfsError(Error &&error)
|
NfsFileReader::OnNfsError(Error &&error)
|
||||||
{
|
{
|
||||||
|
switch (state) {
|
||||||
|
case State::INITIAL:
|
||||||
|
case State::DEFER:
|
||||||
|
case State::MOUNT:
|
||||||
|
case State::IDLE:
|
||||||
|
assert(false);
|
||||||
|
gcc_unreachable();
|
||||||
|
|
||||||
|
case State::OPEN:
|
||||||
|
connection->RemoveLease(*this);
|
||||||
|
state = State::INITIAL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case State::STAT:
|
||||||
|
connection->RemoveLease(*this);
|
||||||
|
connection->Close(fh);
|
||||||
|
state = State::INITIAL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case State::READ:
|
||||||
|
state = State::IDLE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
OnNfsFileError(std::move(error));
|
OnNfsFileError(std::move(error));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user