在 2023/11/29 下午10:41, Miklos Szeredi 写道:
On Wed, 29 Nov 2023 at 10:43, Zhao Chen <winters.zc@xxxxxxxxxxxx> wrote:
From: Peng Tao <bergwolf@xxxxxxxxxxxx>
When a FUSE daemon panic and failover, we aim to minimize the impact on
applications by reusing the existing FUSE connection. During this
process, another daemon is employed to preserve the FUSE connection's file
descriptor.
However, it is possible for some inflight requests to be lost and never
returned. As a result, applications awaiting replies would become stuck
forever. To address this, we can resend these pending requests to the
FUSE daemon, which is done by fuse_resend_pqueue(), ensuring they are
properly processed again.
Signed-off-by: Peng Tao <bergwolf@xxxxxxxxxxxx>
Signed-off-by: Zhao Chen <winters.zc@xxxxxxxxxxxx>
---
fs/fuse/control.c | 20 ++++++++++++++++
fs/fuse/dev.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++
fs/fuse/fuse_i.h | 5 +++-
3 files changed, 83 insertions(+), 1 deletion(-)
diff --git a/fs/fuse/control.c b/fs/fuse/control.c
index 284a35006462..fd2258d701dd 100644
--- a/fs/fuse/control.c
+++ b/fs/fuse/control.c
@@ -44,6 +44,18 @@ static ssize_t fuse_conn_abort_write(struct file *file, const char __user *buf,
return count;
}
+static ssize_t fuse_conn_resend_write(struct file *file, const char __user *buf,
+ size_t count, loff_t *ppos)
+{
+ struct fuse_conn *fc = fuse_ctl_file_conn_get(file);
+
+ if (fc) {
+ fuse_resend_pqueue(fc);
+ fuse_conn_put(fc);
+ }
+ return count;
+}
+
How about triggering this with a notification (FUSE_NOTIFY_RESEND)?
Thanks,
Miklos
Yes, I think using notification is better, I will try to implement it in
v3. Thank you for the review!
Regards,
Zhao Chen