Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Josef Bacik <jbacik@fb.com>
To: Alex Lyakas <alex@zadarastorage.com>,
	linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [RFC PATCH] btrfs: flush_space: treat return value of do_chunk_alloc properly
Date: Thu, 3 Dec 2015 13:18:17 -0500	[thread overview]
Message-ID: <56608769.30700@fb.com> (raw)
In-Reply-To: <CAOcd+r3DHGSu5017ha+m1E9bv2YD4v-LCMBxYywNA9BaLK-DQg@mail.gmail.com>

On 12/03/2015 11:51 AM, Alex Lyakas wrote:
> do_chunk_alloc returns 1 when it succeeds to allocate a new chunk.
> But flush_space will not convert this to 0, and will also return 1.
> As a result, reserve_metadata_bytes will think that flush_space failed,
> and may potentially return this value "1" to the caller (depends how
> reserve_metadata_bytes was called). The caller will also treat this as an error.
> For example, btrfs_block_rsv_refill does:
>
> int ret = -ENOSPC;
> ...
> ret = reserve_metadata_bytes(root, block_rsv, num_bytes, flush);
> if (!ret) {
>          block_rsv_add_bytes(block_rsv, num_bytes, 0);
>          return 0;
> }
>
> return ret;
>
> So it will return -ENOSPC.

Huh nice catch.  Can you add your signed off by, and you can add my

Reviewed-by: Josef Bacik <jbacik@fb.com>

Thanks,

Josef


      parent reply	other threads:[~2015-12-03 18:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-03 16:51 [RFC PATCH] btrfs: flush_space: treat return value of do_chunk_alloc properly Alex Lyakas
2015-12-03 18:14 ` Liu Bo
2015-12-06 10:19   ` Alex Lyakas
2015-12-06 10:32     ` Alex Lyakas
2015-12-06 18:59       ` Liu Bo
2015-12-03 18:18 ` Josef Bacik [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=56608769.30700@fb.com \
    --to=jbacik@fb.com \
    --cc=alex@zadarastorage.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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