summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/nfs/FileReader.cxx24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/nfs/FileReader.cxx b/src/lib/nfs/FileReader.cxx
index 4837e1f0e..7f5506d50 100644
--- a/src/lib/nfs/FileReader.cxx
+++ b/src/lib/nfs/FileReader.cxx
@@ -246,6 +246,30 @@ NfsFileReader::OnNfsCallback(unsigned status, void *data)
void
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));
}