All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Holger Hoffstätte" <holger.hoffstaette@googlemail.com>
To: Alex Lyakas <alex.btrfs@zadarastorage.com>,
	Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Cc: Naohiro Aota <naota@elisp.net>,
	linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] btrfs: clear bio reference after submit_one_bio()
Date: Thu, 5 Nov 2015 14:08:47 +0100	[thread overview]
Message-ID: <563B54DF.7080202@googlemail.com> (raw)
In-Reply-To: <CAOcd+r10Q08zhvjMawOrQ8jWBReD6dYxeEtiZSoqUEuHCeM27g@mail.gmail.com>

On 10/11/15 20:09, Alex Lyakas wrote:
> Hi Naota,
> 
> What happens if btrfs_bio_alloc() in submit_extent_page fails? Then we
> return -ENOMEM to the caller, but we do not set *bio_ret to NULL. And
> if *bio_ret was non-NULL upon entry into submit_extent_page, then we
> had submitted this bio before getting to btrfs_bio_alloc(). So should
> btrfs_bio_alloc() failure be handled in the same way?
> 
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index 3915c94..cd443bc 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -2834,8 +2834,11 @@ static int submit_extent_page(int rw, struct
> extent_io_tree *tree,
> 
>         bio = btrfs_bio_alloc(bdev, sector, BIO_MAX_PAGES,
>                         GFP_NOFS | __GFP_HIGH);
> -       if (!bio)
> +       if (!bio) {
> +               if (bio_ret)
> +                       *bio_ret = NULL;
>                 return -ENOMEM;
> +       }
> 
>         bio_add_page(bio, page, page_size, offset);
>         bio->bi_end_io = end_io_func;
> 

Did you get any feedback on this? It seems it could cause data loss or
corruption on allocation failures, no?

-h


  reply	other threads:[~2015-11-05 13:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-05 16:01 [PATCH] btrfs: clear bio reference after submit_one_bio() Naohiro Aota
2015-01-06 22:46 ` Satoru Takeuchi
2015-10-11 18:09   ` Alex Lyakas
2015-11-05 13:08     ` Holger Hoffstätte [this message]
2015-11-07 16:24       ` Alex Lyakas

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=563B54DF.7080202@googlemail.com \
    --to=holger.hoffstaette@googlemail.com \
    --cc=alex.btrfs@zadarastorage.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=naota@elisp.net \
    --cc=takeuchi_satoru@jp.fujitsu.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.