From: luzhipeng <luzhipeng@cestc.cn>
To: Vladimir Sementsov-Ogievskiy <vsementsov@yandex-team.ru>,
"Denis V. Lunev" <den@virtuozzo.com>,
qemu-devel <qemu-devel@nongnu.org>
Cc: Eric Blake <eblake@redhat.com>, qemu-block@nongnu.org
Subject: Re: [PATCH] qemu-nbd: set timeout to qemu-nbd socket
Date: Tue, 27 Sep 2022 11:20:07 +0800 [thread overview]
Message-ID: <fa34275c-bbfb-45dd-4ab0-76481d92fac8@cestc.cn> (raw)
In-Reply-To: <50b3e1ee-8bba-ae28-ca0e-4cb489a65ad5@yandex-team.ru>
在 2022/9/26 20:44, Vladimir Sementsov-Ogievskiy 写道:
> On 9/26/22 14:34, Denis V. Lunev wrote:
>> On 9/26/22 12:05, Vladimir Sementsov-Ogievskiy wrote:
>>> [+ Den]
>>>
>>> On 9/25/22 16:53, luzhipeng wrote:
>>>> From: lu zhipeng <luzhipeng@cestc.cn>
>>>>
>>>> Prevent the NBD socket stuck all the time, So
>>>> set timeout.
>>>>
>>>> Signed-off-by: lu zhipeng <luzhipeng@cestc.cn>
>>>> ---
>>>> nbd/client.c | 8 ++++++++
>>>> 1 file changed, 8 insertions(+)
>>>>
>>>> diff --git a/nbd/client.c b/nbd/client.c
>>>> index 30d5383cb1..89dde53a0f 100644
>>>> --- a/nbd/client.c
>>>> +++ b/nbd/client.c
>>>> @@ -24,6 +24,8 @@
>>>> #include "nbd-internal.h"
>>>> #include "qemu/cutils.h"
>>>> +#define NBD_DEFAULT_TIMEOUT 30
>>>> +
>>>> /* Definitions for opaque data types */
>>>> static QTAILQ_HEAD(, NBDExport) exports =
>>>> QTAILQ_HEAD_INITIALIZER(exports);
>>>> @@ -1301,6 +1303,12 @@ int nbd_init(int fd, QIOChannelSocket *sioc,
>>>> NBDExportInfo *info,
>>>> }
>>>> }
>>>> + if (ioctl(fd, NBD_SET_TIMEOUT, NBD_DEFAULT_TIMEOUT) < 0) {
>>>> + int serrno = errno;
>>>> + error_setg(errp, "Failed setting timeout");
>>>> + return -serrno;
>>>> + }
>>>> +
>>>> trace_nbd_init_finish();
>>>> return 0;
>>>
>>>
>>> Personally, I don't see a problem in enabling timeout by default..
>>> But probably we need a new option instead?
>>>
>>>
>> I believe that this should be the same story as we have had with
>> KEEPALIVE. This should be set as an option and downstream
>> will change its default when necessary.
>>
>
> It's also interesting, how NBD_SET_TIMEOUT would interfere with
> keep-alive options set on the socket. Isn't existing keep-alive option
> already enough, do we need both timeouts?
>
> (and yes, if we need both ways for different cases, we definitely should
> keep a possibility for the user to enable only one timeout, so now I
> agree, that we need an option for this new feature)
>
>
keep-alive is only valid for tcp mode, unix domain is not valid
next prev parent reply other threads:[~2022-09-27 3:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-25 13:53 [PATCH] qemu-nbd: set timeout to qemu-nbd socket luzhipeng
2022-09-26 10:05 ` Vladimir Sementsov-Ogievskiy
2022-09-26 11:34 ` Denis V. Lunev
2022-09-26 12:44 ` Vladimir Sementsov-Ogievskiy
2022-09-27 3:20 ` luzhipeng [this message]
2022-09-27 6:16 ` luzhipeng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=fa34275c-bbfb-45dd-4ab0-76481d92fac8@cestc.cn \
--to=luzhipeng@cestc.cn \
--cc=den@virtuozzo.com \
--cc=eblake@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=vsementsov@yandex-team.ru \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).