All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amir Goldstein <amir73il@gmail.com>
To: Hou Tao <houtao1@huawei.com>
Cc: fstests <fstests@vger.kernel.org>
Subject: Re: [PATCH] log-writes: fix possible infinite loop in zero_range()
Date: Tue, 17 Oct 2017 14:54:16 +0300	[thread overview]
Message-ID: <CAOQ4uxjZzkWNzYKyFFBab0+pY=0=mHpA3ASc2UMJqn3AYrrNqg@mail.gmail.com> (raw)
In-Reply-To: <1508210445-27135-1-git-send-email-houtao1@huawei.com>

On Tue, Oct 17, 2017 at 6:20 AM, Hou Tao <houtao1@huawei.com> wrote:
> Found it when trying to remove the limitation of log->max_zero_size.
>
> Signed-off-by: Hou Tao <houtao1@huawei.com>

Reviewed-by: Amir Goldstein <amir73il@gmail.com>

> ---
>  src/log-writes/log-writes.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/log-writes/log-writes.c b/src/log-writes/log-writes.c
> index fab447a..0939157 100644
> --- a/src/log-writes/log-writes.c
> +++ b/src/log-writes/log-writes.c
> @@ -65,6 +65,9 @@ static int zero_range(struct log *log, u64 start, u64 len)
>
>         memset(buf, 0, bufsize);
>         while (len) {
> +               if (len < bufsize)
> +                       bufsize = len;
> +
>                 ret = pwrite(log->replayfd, buf, bufsize, start);
>                 if (ret != bufsize) {
>                         fprintf(stderr, "Error zeroing file: %d\n", errno);
> --
> 2.5.0
>
> --
> To unsubscribe from this list: send the line "unsubscribe fstests" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

      reply	other threads:[~2017-10-17 11:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-17  3:20 [PATCH] log-writes: fix possible infinite loop in zero_range() Hou Tao
2017-10-17 11:54 ` Amir Goldstein [this message]

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='CAOQ4uxjZzkWNzYKyFFBab0+pY=0=mHpA3ASc2UMJqn3AYrrNqg@mail.gmail.com' \
    --to=amir73il@gmail.com \
    --cc=fstests@vger.kernel.org \
    --cc=houtao1@huawei.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.