* [PATCH ssh v2] ssh: Do not switch session to non-blocking mode
@ 2024-11-13 12:55 Richard W.M. Jones
2024-11-22 14:45 ` Kevin Wolf
2024-11-26 16:10 ` Michael Tokarev
0 siblings, 2 replies; 3+ messages in thread
From: Richard W.M. Jones @ 2024-11-13 12:55 UTC (permalink / raw)
To: qemu-block; +Cc: qemu-devel, kwolf, hreitz, jjelen, mpitt
From: Jakub Jelen <jjelen@redhat.com>
The libssh does not handle non-blocking mode in SFTP correctly. The
driver code already changes the mode to blocking for the SFTP
initialization, but for some reason changes to non-blocking mode.
This used to work accidentally until libssh in 0.11 branch merged
the patch to avoid infinite looping in case of network errors:
https://gitlab.com/libssh/libssh-mirror/-/merge_requests/498
Since then, the ssh driver in qemu fails to read files over SFTP
as the first SFTP messages exchanged after switching the session
to non-blocking mode return SSH_AGAIN, but that message is lost
int the SFTP internals and interpretted as SSH_ERROR, which is
returned to the caller:
https://gitlab.com/libssh/libssh-mirror/-/issues/280
This is indeed an issue in libssh that we should address in the
long term, but it will require more work on the internals. For
now, the SFTP is not supported in non-blocking mode.
Fixes: https://gitlab.com/libssh/libssh-mirror/-/issues/280
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
---
block/ssh.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/block/ssh.c b/block/ssh.c
index 9f8140bcb6..b9f33ec739 100644
--- a/block/ssh.c
+++ b/block/ssh.c
@@ -866,9 +866,6 @@ static int ssh_open(BlockDriverState *bs, QDict *options, int bdrv_flags,
goto err;
}
- /* Go non-blocking. */
- ssh_set_blocking(s->session, 0);
-
if (s->attrs->type == SSH_FILEXFER_TYPE_REGULAR) {
bs->supported_truncate_flags = BDRV_REQ_ZERO_WRITE;
}
--
2.46.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH ssh v2] ssh: Do not switch session to non-blocking mode
2024-11-13 12:55 [PATCH ssh v2] ssh: Do not switch session to non-blocking mode Richard W.M. Jones
@ 2024-11-22 14:45 ` Kevin Wolf
2024-11-26 16:10 ` Michael Tokarev
1 sibling, 0 replies; 3+ messages in thread
From: Kevin Wolf @ 2024-11-22 14:45 UTC (permalink / raw)
To: Richard W.M. Jones; +Cc: qemu-block, qemu-devel, hreitz, jjelen, mpitt
Am 13.11.2024 um 13:55 hat Richard W.M. Jones geschrieben:
> From: Jakub Jelen <jjelen@redhat.com>
>
> The libssh does not handle non-blocking mode in SFTP correctly. The
> driver code already changes the mode to blocking for the SFTP
> initialization, but for some reason changes to non-blocking mode.
> This used to work accidentally until libssh in 0.11 branch merged
> the patch to avoid infinite looping in case of network errors:
>
> https://gitlab.com/libssh/libssh-mirror/-/merge_requests/498
>
> Since then, the ssh driver in qemu fails to read files over SFTP
> as the first SFTP messages exchanged after switching the session
> to non-blocking mode return SSH_AGAIN, but that message is lost
> int the SFTP internals and interpretted as SSH_ERROR, which is
> returned to the caller:
>
> https://gitlab.com/libssh/libssh-mirror/-/issues/280
>
> This is indeed an issue in libssh that we should address in the
> long term, but it will require more work on the internals. For
> now, the SFTP is not supported in non-blocking mode.
>
> Fixes: https://gitlab.com/libssh/libssh-mirror/-/issues/280
> Signed-off-by: Jakub Jelen <jjelen@redhat.com>
> Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Thanks, applied to the block branch.
Kevin
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH ssh v2] ssh: Do not switch session to non-blocking mode
2024-11-13 12:55 [PATCH ssh v2] ssh: Do not switch session to non-blocking mode Richard W.M. Jones
2024-11-22 14:45 ` Kevin Wolf
@ 2024-11-26 16:10 ` Michael Tokarev
1 sibling, 0 replies; 3+ messages in thread
From: Michael Tokarev @ 2024-11-26 16:10 UTC (permalink / raw)
To: Richard W.M. Jones, qemu-block
Cc: qemu-devel, kwolf, hreitz, jjelen, mpitt, qemu-stable
13.11.2024 15:55, Richard W.M. Jones wrote:
> From: Jakub Jelen <jjelen@redhat.com>
>
> The libssh does not handle non-blocking mode in SFTP correctly. The
> driver code already changes the mode to blocking for the SFTP
> initialization, but for some reason changes to non-blocking mode.
> This used to work accidentally until libssh in 0.11 branch merged
> the patch to avoid infinite looping in case of network errors:
>
> https://gitlab.com/libssh/libssh-mirror/-/merge_requests/498
>
> Since then, the ssh driver in qemu fails to read files over SFTP
> as the first SFTP messages exchanged after switching the session
> to non-blocking mode return SSH_AGAIN, but that message is lost
> int the SFTP internals and interpretted as SSH_ERROR, which is
> returned to the caller:
>
> https://gitlab.com/libssh/libssh-mirror/-/issues/280
>
> This is indeed an issue in libssh that we should address in the
> long term, but it will require more work on the internals. For
> now, the SFTP is not supported in non-blocking mode.
>
> Fixes: https://gitlab.com/libssh/libssh-mirror/-/issues/280
> Signed-off-by: Jakub Jelen <jjelen@redhat.com>
> Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
> ---
> block/ssh.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/block/ssh.c b/block/ssh.c
> index 9f8140bcb6..b9f33ec739 100644
> --- a/block/ssh.c
> +++ b/block/ssh.c
> @@ -866,9 +866,6 @@ static int ssh_open(BlockDriverState *bs, QDict *options, int bdrv_flags,
> goto err;
> }
>
> - /* Go non-blocking. */
> - ssh_set_blocking(s->session, 0);
> -
> if (s->attrs->type == SSH_FILEXFER_TYPE_REGULAR) {
> bs->supported_truncate_flags = BDRV_REQ_ZERO_WRITE;
> }
I'm picking this up for the next stable series, since new libssh
is being released and used. Hopefully the resulting code wont
break with old libssh.
Thanks,
/mjt
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-26 16:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-13 12:55 [PATCH ssh v2] ssh: Do not switch session to non-blocking mode Richard W.M. Jones
2024-11-22 14:45 ` Kevin Wolf
2024-11-26 16:10 ` Michael Tokarev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).