58 lines
2.1 KiB
Diff
58 lines
2.1 KiB
Diff
|
|
From 0dbad5e4ba71f344767fee9d7180495d8cb26a84 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Jiajie Li <lijiajie11@huawei.com>
|
||
|
|
Date: Fri, 11 Mar 2022 21:24:16 +0800
|
||
|
|
Subject: [PATCH 6/8] console: fix the bug of delete park fd
|
||
|
|
|
||
|
|
Console device need two fd: listen_fd and stream_fd. Only one of
|
||
|
|
them can be valid in event loop. When stream_fd is valid, it will
|
||
|
|
park stream fd. At this time, send the reboot command through the
|
||
|
|
console device, deactivate function will delete both of these fds.
|
||
|
|
But the sequence is importent. If you delete listen_fd first, then
|
||
|
|
deleting stream_fd will try to delete the listen_fd which is it's
|
||
|
|
park fd. It will get an error: NoParkedFd.
|
||
|
|
|
||
|
|
Fix it by delete delete stream_fd first.
|
||
|
|
|
||
|
|
Signed-off-by: Jiajie Li <lijiajie11@huawei.com>
|
||
|
|
---
|
||
|
|
virtio/src/console.rs | 16 ++++++++--------
|
||
|
|
1 file changed, 8 insertions(+), 8 deletions(-)
|
||
|
|
|
||
|
|
diff --git a/virtio/src/console.rs b/virtio/src/console.rs
|
||
|
|
index 48d3838..1192d28 100644
|
||
|
|
--- a/virtio/src/console.rs
|
||
|
|
+++ b/virtio/src/console.rs
|
||
|
|
@@ -234,14 +234,6 @@ impl ConsoleHandler {
|
||
|
|
}
|
||
|
|
}
|
||
|
|
ChardevType::Socket(_) => {
|
||
|
|
- let listener_fd = locked_chardev.listener.as_ref().unwrap().as_raw_fd();
|
||
|
|
- notifiers.push(EventNotifier::new(
|
||
|
|
- NotifierOperation::Delete,
|
||
|
|
- listener_fd,
|
||
|
|
- None,
|
||
|
|
- EventSet::IN,
|
||
|
|
- Vec::new(),
|
||
|
|
- ));
|
||
|
|
if let Some(stream_fd) = locked_chardev.stream_fd {
|
||
|
|
notifiers.push(EventNotifier::new(
|
||
|
|
NotifierOperation::Delete,
|
||
|
|
@@ -251,6 +243,14 @@ impl ConsoleHandler {
|
||
|
|
Vec::new(),
|
||
|
|
));
|
||
|
|
}
|
||
|
|
+ let listener_fd = locked_chardev.listener.as_ref().unwrap().as_raw_fd();
|
||
|
|
+ notifiers.push(EventNotifier::new(
|
||
|
|
+ NotifierOperation::Delete,
|
||
|
|
+ listener_fd,
|
||
|
|
+ None,
|
||
|
|
+ EventSet::IN,
|
||
|
|
+ Vec::new(),
|
||
|
|
+ ));
|
||
|
|
}
|
||
|
|
_ => (),
|
||
|
|
}
|
||
|
|
--
|
||
|
|
2.20.1
|
||
|
|
|