render / rpms / qemu

Forked from rpms/qemu 10 months ago
Clone

Blame 0072-virtiofsd-Handle-hard-reboot.patch

1d442b
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
1d442b
Date: Mon, 27 Jan 2020 19:01:41 +0000
1d442b
Subject: [PATCH] virtiofsd: Handle hard reboot
1d442b
MIME-Version: 1.0
1d442b
Content-Type: text/plain; charset=UTF-8
1d442b
Content-Transfer-Encoding: 8bit
1d442b
1d442b
Handle a
1d442b
  mount
1d442b
  hard reboot (without unmount)
1d442b
  mount
1d442b
1d442b
we get another 'init' which FUSE doesn't normally expect.
1d442b
1d442b
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442b
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
1d442b
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
1d442b
(cherry picked from commit e8556f49098b5d95634e592d79a97f761b76c96e)
1d442b
---
1d442b
 tools/virtiofsd/fuse_lowlevel.c | 16 +++++++++++++++-
1d442b
 1 file changed, 15 insertions(+), 1 deletion(-)
1d442b
1d442b
diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
1d442b
index 7d742b5a72..65f91dabae 100644
1d442b
--- a/tools/virtiofsd/fuse_lowlevel.c
1d442b
+++ b/tools/virtiofsd/fuse_lowlevel.c
1d442b
@@ -2433,7 +2433,21 @@ void fuse_session_process_buf_int(struct fuse_session *se,
1d442b
             goto reply_err;
1d442b
         }
1d442b
     } else if (in->opcode == FUSE_INIT || in->opcode == CUSE_INIT) {
1d442b
-        goto reply_err;
1d442b
+        if (fuse_lowlevel_is_virtio(se)) {
1d442b
+            /*
1d442b
+             * TODO: This is after a hard reboot typically, we need to do
1d442b
+             * a destroy, but we can't reply to this request yet so
1d442b
+             * we can't use do_destroy
1d442b
+             */
1d442b
+            fuse_log(FUSE_LOG_DEBUG, "%s: reinit\n", __func__);
1d442b
+            se->got_destroy = 1;
1d442b
+            se->got_init = 0;
1d442b
+            if (se->op.destroy) {
1d442b
+                se->op.destroy(se->userdata);
1d442b
+            }
1d442b
+        } else {
1d442b
+            goto reply_err;
1d442b
+        }
1d442b
     }
1d442b
 
1d442b
     err = EACCES;