Re: Can't write from guest to host with webdav

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Jul 19, 2020 at 6:12 PM Koopa Koopa <codingkoopa@xxxxxxxxx> wrote:
>
> On 7/19/20, Jakub Janku <jjanku@xxxxxxxxxx> wrote:
> > Hi!
> >
> > On Sun, Jul 19, 2020 at 9:34 AM Koopa Koopa <codingkoopa@xxxxxxxxx> wrote:
> >>
> >> Hi all,
> >>
> >> I'm looking to share a folder between my Arch Linux host and a Windows 10
> >> guest, and SPICE's folder sharing with webdav seems to be the best option
> >> for me. I've set up the QEMU devices that webdav needs, and installed the
> >> Windows service. I have the drive mapped, and am able to navigate the host
> >> folder (apart from the occasional "Windows cannot access
> >> \\localhost@9843\DavWWWRoot\" that doesn't occur again), and copy files
> >> from the host to the guest. When trying to copy a new file (with data) or
> >> write to an existing file from the guest, though, the application (e.g.
> >> File Explorer, or other programs which save files) hangs for a little bit,
> >> before the transaction fails. For File Explorer, it displays "Error
> >> 0x80070021: The process cannot access the file because another process has
> >> locked a portion of the file."
> >>
> >> This is the output of remote-viewer:
> >>   (remote-viewer:16120): GSpice-WARNING **: 12:58:46.205: Warning no
> >> automount-inhibiting implementation available
> >
> > As you say, this happens in non-GNOME environments. But it's related
> > to usb redirection, not webdav.
> >>
> >>   (remote-viewer:16120): phodav-WARNING **: 12:58:57.910:
> >> (../phodav-2.4/libphodav/phodav-method-propfind.c:70):prop_resourcetype:
> >> code should not be reached
> >>
> >>   (remote-viewer:16120): phodav-WARNING **: 12:59:04.714:
> >> (../phodav-2.4/libphodav/phodav-method-propfind.c:70):prop_resourcetype:
> >> code should not be reached
> >
> > I know that these warnings can happen for example if the shared folder
> > contains a broken symlink. Is that your case? Basically anything in
> > the shared folder that isn't a regular file or a directory can emit
> > this warning, but it shouldn't cause the described issues afaik.
>
> Yep, that is the case. I had a broken symlink in the root directory of
> my share, which explains why that error only occurred in that
> directory. I've removed that file, and that error no longer occurs.

Great, so that makes this one clear.
>
> As for the main issue, upon some more testing, I've determined that:
> - I can copy files to the root of a $HOME share.
> - I cannot copy files to a mounted device within the $HOME share.
> - I cannot copy files to a share created at or within the mountpoint.
>
> The drive that my $HOME is on is ext4, and the mounted device (in
> fact, there are two of these in my home directory) is NTFS.

How frequent is this issue? Can you copy larger files?
>
> >>
> >>   (remote-viewer:16120): GSpice-WARNING **: 12:59:04.793:
> >> (../spice-gtk-0.38/src/channel-webdav.c:330):demux_to_client_cb: runtime
> >> check failed: (size == c->demux.size)
> >>   phodav-Message: 13:00:06.047: missing lock: /testfile
> >> urn:uuid:ceb212f1-f8af-4dd3-b36c-a7e627b6c08a
> >>   phodav-Message: 13:00:06.062: missing lock: /testfile
> >> urn:uuid:ceb212f1-f8af-4dd3-b36c-a7e627b6c08a
> >>   phodav-Message: 13:00:06.076: missing lock: /testfile
> >> urn:uuid:ceb212f1-f8af-4dd3-b36c-a7e627b6c08a
> >
> > I'm not able to reproduce it, so more logs would be helpful.
> > Could you please run remote-viewer or spicy with the following options
> > and attach the output?
> > G_MESSAGES_DEBUG=phodav remote-viewer --spice-debug
> >
>
> Sure. I've attached a remote-viewer log ran with those parameters,
> from right before I copied the file, until the File Explorer error was
> displayed. I had a share set up to where the mountpoint is the shared
> directory, and copied a file named "export1.csv" to the root of the
> share.

Thanks a lot!

Would you be able to recompile spice-gtk with the attached patch (it
adds some more logs and could perhaps fix the issue)? If so, please
send the output in the same fashion as you did now, spicy is just fine
for this purpose.

Cheers,
Jakub
>
> >>
> >> I read that the first GSpice error always occurs on non-GNOME host
> >> environments. The phodav error occurs whenever I view the root directory
> >> of the share, or try copying/writing to a file anywhere in the share. The
> >> second GSpice and other phodav messages occur when copying/writing a file
> >> in the share.
> >>
> >> This occurs both with remote-viewer, and spicy. The same result occurs
> >> whether or not I have the "Read only" checkbox in remote-viewer checked.
> >>
> >> Thanks!
> >> _______________________________________________
> >> Spice-devel mailing list
> >> Spice-devel@xxxxxxxxxxxxxxxxxxxxx
> >> https://lists.freedesktop.org/mailman/listinfo/spice-devel
> >
> > Thanks,
> > Jakub
> >
> >
>
> Thanks!
From 21a380125bda06b3443a93a70500c599bec741df Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Jank=C5=AF?= <jjanku@xxxxxxxxxx>
Date: Sun, 19 Jul 2020 20:24:16 +0200
Subject: [PATCH spice-gtk] fix: check if client is closed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Signed-off-by: Jakub Janků <jjanku@xxxxxxxxxx>
---
 src/channel-webdav.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/src/channel-webdav.c b/src/channel-webdav.c
index c4ad144..7639d5f 100644
--- a/src/channel-webdav.c
+++ b/src/channel-webdav.c
@@ -188,6 +188,7 @@ typedef struct Client
     GIOStream *pipe;
     gint64 id;
     GCancellable *cancellable;
+    gboolean removed;
 
     struct {
         gint64 id;
@@ -222,9 +223,13 @@ static void remove_client(Client *client)
     if (g_cancellable_is_cancelled(client->cancellable))
         return;
 
+    CHANNEL_DEBUG(SPICE_CHANNEL(client->self), "removing client %p", client);
+
     g_cancellable_cancel(client->cancellable);
 
-    g_hash_table_remove(client->self->priv->clients, &client->id);
+    if (!client->removed) {
+        g_hash_table_remove(client->self->priv->clients, &client->id);
+    }
 }
 
 static void
@@ -234,6 +239,8 @@ mux_msg_flushed_cb(GObject *source_object,
 {
     Client *client = user_data;
 
+    CHANNEL_DEBUG(SPICE_CHANNEL(client->self), "mux_msg_flushed_cb for client %p", client);
+
     if (spice_vmc_write_finish(SPICE_CHANNEL(source_object), result, NULL) == -1 ||
         client->mux.size == 0 ||
         !client_start_read(client)) {
@@ -252,6 +259,9 @@ static void server_reply_cb(GObject *source_object,
     gssize size;
 
     size = g_input_stream_read_finish(G_INPUT_STREAM(source_object), res, &err);
+
+    CHANNEL_DEBUG(SPICE_CHANNEL(client->self), "server_reply_cb for client %p, size %ld", client, size);
+
     if (err || g_cancellable_is_cancelled(client->cancellable))
         goto end;
 
@@ -259,6 +269,12 @@ static void server_reply_cb(GObject *source_object,
     g_return_if_fail(size >= 0);
     client->mux.size = GUINT16_TO_LE(size);
 
+    if (size == 0) {
+        /* remove client early */
+        g_hash_table_remove(client->self->priv->clients, &client->id);
+        client->removed = TRUE;
+    }
+
     spice_vmc_write_async(SPICE_CHANNEL(client->self),
                           &client->mux,
                           sizeof(gint64) + sizeof(guint16) + size,
@@ -425,6 +441,13 @@ static void data_read_cb(GObject *source_object,
 
     client = g_hash_table_lookup(c->clients, &c->demux.client);
 
+    if (client && g_io_stream_is_closed(client->pipe)) {
+        CHANNEL_DEBUG(self, "client in hashtable, but already closed, removing");
+        g_hash_table_remove(client->self->priv->clients, &client->id);
+        client->removed = TRUE;
+        client = NULL;
+    }
+
     if (client)
         demux_to_client(client);
     else if (size > 0) {
-- 
2.26.2

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]