thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 5 months ago
Clone
22c213
From 616407b06517361ce444dcc0960aeaf55b52da33 Mon Sep 17 00:00:00 2001
22c213
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
22c213
Date: Mon, 27 Jan 2020 19:01:41 +0100
22c213
Subject: [PATCH 070/116] virtiofsd: Handle hard reboot
22c213
MIME-Version: 1.0
22c213
Content-Type: text/plain; charset=UTF-8
22c213
Content-Transfer-Encoding: 8bit
22c213
22c213
RH-Author: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
Message-id: <20200127190227.40942-67-dgilbert@redhat.com>
22c213
Patchwork-id: 93521
22c213
O-Subject: [RHEL-AV-8.2 qemu-kvm PATCH 066/112] virtiofsd: Handle hard reboot
22c213
Bugzilla: 1694164
22c213
RH-Acked-by: Philippe Mathieu-Daudé <philmd@redhat.com>
22c213
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
22c213
RH-Acked-by: Sergio Lopez Pascual <slp@redhat.com>
22c213
22c213
From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
22c213
22c213
Handle a
22c213
  mount
22c213
  hard reboot (without unmount)
22c213
  mount
22c213
22c213
we get another 'init' which FUSE doesn't normally expect.
22c213
22c213
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
22c213
Signed-off-by: Dr. David Alan Gilbert <dgilbert@redhat.com>
22c213
(cherry picked from commit e8556f49098b5d95634e592d79a97f761b76c96e)
22c213
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
22c213
---
22c213
 tools/virtiofsd/fuse_lowlevel.c | 16 +++++++++++++++-
22c213
 1 file changed, 15 insertions(+), 1 deletion(-)
22c213
22c213
diff --git a/tools/virtiofsd/fuse_lowlevel.c b/tools/virtiofsd/fuse_lowlevel.c
22c213
index 7d742b5..65f91da 100644
22c213
--- a/tools/virtiofsd/fuse_lowlevel.c
22c213
+++ b/tools/virtiofsd/fuse_lowlevel.c
22c213
@@ -2433,7 +2433,21 @@ void fuse_session_process_buf_int(struct fuse_session *se,
22c213
             goto reply_err;
22c213
         }
22c213
     } else if (in->opcode == FUSE_INIT || in->opcode == CUSE_INIT) {
22c213
-        goto reply_err;
22c213
+        if (fuse_lowlevel_is_virtio(se)) {
22c213
+            /*
22c213
+             * TODO: This is after a hard reboot typically, we need to do
22c213
+             * a destroy, but we can't reply to this request yet so
22c213
+             * we can't use do_destroy
22c213
+             */
22c213
+            fuse_log(FUSE_LOG_DEBUG, "%s: reinit\n", __func__);
22c213
+            se->got_destroy = 1;
22c213
+            se->got_init = 0;
22c213
+            if (se->op.destroy) {
22c213
+                se->op.destroy(se->userdata);
22c213
+            }
22c213
+        } else {
22c213
+            goto reply_err;
22c213
+        }
22c213
     }
22c213
 
22c213
     err = EACCES;
22c213
-- 
22c213
1.8.3.1
22c213