aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/nfs/FileReader.cxx
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/lib/nfs/FileReader.cxx15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/lib/nfs/FileReader.cxx b/src/lib/nfs/FileReader.cxx
index 52d951fa6..d2be46f8e 100644
--- a/src/lib/nfs/FileReader.cxx
+++ b/src/lib/nfs/FileReader.cxx
@@ -57,11 +57,18 @@ NfsFileReader::Close()
connection->RemoveLease(*this);
- if (state > State::MOUNT && state != State::IDLE)
- connection->Cancel(*this);
-
- if (state > State::OPEN)
+ if (state == State::IDLE)
+ /* no async operation in progress: can close
+ immediately */
connection->Close(fh);
+ else if (state > State::OPEN)
+ /* one async operation in progress: cancel it and
+ defer the nfs_close_async() call */
+ connection->CancelAndClose(fh, *this);
+ else if (state > State::MOUNT)
+ /* we don't have a file handle yet - just cancel the
+ async operation */
+ connection->Cancel(*this);
state = State::INITIAL;
}