Commit b293b160 authored by Max Kellermann's avatar Max Kellermann

lib/nfs/Connection: broadcast error before closing connection

During the NfsLease::OnNfsConnectionFailed() call, the old (defunct) nfs_context may be used to close file handles. Such code does not yet exist, but will be added soon to fix other bugs.
parent f5f43db2
...@@ -409,10 +409,10 @@ NfsConnection::OnSocketReady(unsigned flags) ...@@ -409,10 +409,10 @@ NfsConnection::OnSocketReady(unsigned flags)
error.Format(nfs_domain, "NFS connection has failed: %s", error.Format(nfs_domain, "NFS connection has failed: %s",
nfs_get_error(context)); nfs_get_error(context));
BroadcastError(std::move(error));
DestroyContext(); DestroyContext();
closed = true; closed = true;
BroadcastError(std::move(error));
} else if (SocketMonitor::IsDefined() && nfs_get_fd(context) < 0) { } else if (SocketMonitor::IsDefined() && nfs_get_fd(context) < 0) {
/* this happens when rpc_reconnect_requeue() is called /* this happens when rpc_reconnect_requeue() is called
after the connection broke, but autoreconnet was after the connection broke, but autoreconnet was
...@@ -425,10 +425,10 @@ NfsConnection::OnSocketReady(unsigned flags) ...@@ -425,10 +425,10 @@ NfsConnection::OnSocketReady(unsigned flags)
error.Format(nfs_domain, error.Format(nfs_domain,
"NFS socket disappeared: %s", msg); "NFS socket disappeared: %s", msg);
BroadcastError(std::move(error));
DestroyContext(); DestroyContext();
closed = true; closed = true;
BroadcastError(std::move(error));
} }
assert(in_event); assert(in_event);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment