yeahuh / rpms / qemu-kvm

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