From: Eric Blake <eblake@redhat.com>
To: Peter Lieven <pl@kamp.de>, qemu-devel@nongnu.org
Cc: kwolf@redhat.com, pbonzini@redhat.com, stefanha@redhat.com,
ronniesahlberg@gmail.com
Subject: Re: [Qemu-devel] [PATCH] block/nfs: add knob to set readahead
Date: Mon, 23 Jun 2014 09:11:13 -0600 [thread overview]
Message-ID: <53A84391.7040904@redhat.com> (raw)
In-Reply-To: <1403533836-28589-1-git-send-email-pl@kamp.de>
[-- Attachment #1: Type: text/plain, Size: 2129 bytes --]
On 06/23/2014 08:30 AM, Peter Lieven wrote:
> upcoming libnfs will feature internal readahead support.
> Add a knob to pass the optional readahead value as a URL
> parameter.
>
> This patch fixes also the incorrect usage of strncmp.
But not the incorrect usage of atoi() (hint - atoi cannot detect
overflow; it should NEVER be used on user-provided input; instead
strtol() should be preferred).
>
> Signed-off-by: Peter Lieven <pl@kamp.de>
> ---
> block/nfs.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/block/nfs.c b/block/nfs.c
> index ec43201..a5c0577 100644
> --- a/block/nfs.c
> +++ b/block/nfs.c
> @@ -309,12 +309,16 @@ static int64_t nfs_client_open(NFSClient *client, const char *filename,
> qp->p[i].name);
> goto fail;
> }
> - if (!strncmp(qp->p[i].name, "uid", 3)) {
> + if (!strcmp(qp->p[i].name, "uid")) {
> nfs_set_uid(client->context, atoi(qp->p[i].value));
Of course, the use of atoi was pre-existing, so it doesn't necessarily
need to be done in _this_ patch.
> - } else if (!strncmp(qp->p[i].name, "gid", 3)) {
> + } else if (!strcmp(qp->p[i].name, "gid")) {
> nfs_set_gid(client->context, atoi(qp->p[i].value));
> - } else if (!strncmp(qp->p[i].name, "tcp-syncnt", 10)) {
> + } else if (!strcmp(qp->p[i].name, "tcp-syncnt")) {
> nfs_set_tcp_syncnt(client->context, atoi(qp->p[i].value));
> +#ifdef LIBNFS_FEATURE_READAHEAD
> + } else if (!strcmp(qp->p[i].name, "readahead")) {
> + nfs_set_readahead(client->context, atoi(qp->p[i].value));
> +#endif
I'm not a fan of adding even more special-casing to the file-name URI
without also adding it to the QAPI schema for use in the blockdev-add
command. Of course, we don't have structured nfs options for
blockdev-add yet, but maybe it's time to start thinking about that
addition before we do this addition.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
next prev parent reply other threads:[~2014-06-23 15:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-23 14:30 [Qemu-devel] [PATCH] block/nfs: add knob to set readahead Peter Lieven
2014-06-23 15:11 ` Eric Blake [this message]
2014-06-23 20:47 ` Peter Lieven
2014-06-23 21:05 ` Eric Blake
2014-06-24 8:53 ` Peter Lieven
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=53A84391.7040904@redhat.com \
--to=eblake@redhat.com \
--cc=kwolf@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pl@kamp.de \
--cc=qemu-devel@nongnu.org \
--cc=ronniesahlberg@gmail.com \
--cc=stefanha@redhat.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.