public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: Christoph Hellwig <hch@infradead.org>, Qu Wenruo <wqu@suse.com>
Cc: linux-btrfs@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 1/3] btrfs: avoid double clean up when submit_one_bio() failed
Date: Fri, 15 Apr 2022 15:02:41 +0800	[thread overview]
Message-ID: <37226b35-7d5a-dd86-7b20-7a0dfd3b96fc@gmx.com> (raw)
In-Reply-To: <YlkQgTCv+Iw2QzPz@infradead.org>



On 2022/4/15 14:28, Christoph Hellwig wrote:
> Btw, btrfs_submit_compressed_write also seems to do some double cleanups,
> even if the pattern is slightly different as the bio is allocated inside
> btrfs_submit_compressed_write itself.  Can someone who is more familiar
> with that code look into that?

I just checked the code, it's indeed causing problems.

If btrfs_csum_one_bio() or submit_compressed_bio() failed (either ENOMEM
or failed some sanity checks), then we have one bio for writing the
compressed data back to disk.

Finish_cb label will call endio on it, which will call:
  -> end_compressed_bio_write()
     -> finish_compressed_bio() (this needs the compressed write bio not
be split)

Then finish_cb tag will also call finish_compressed_bio() directly.
Double freeing cb, and double clearing writeback flags.

The only relief is, regular EIO won't trigger the bug for write path.


But this can not be said to btrfs_submit_compressed_read(), which has
the same problem and can be triggered by EIO error easily.

Do you want to give it a try? Or mind to me fix it?

Thanks,
Qu

  reply	other threads:[~2022-04-15  7:03 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-12 12:30 [PATCH v2 0/3] btrfs: vairous bug fixes related to generic/475 failure with subpage cases Qu Wenruo
2022-04-12 12:30 ` [PATCH v2 1/3] btrfs: avoid double clean up when submit_one_bio() failed Qu Wenruo
2022-04-12 20:41   ` David Sterba
2022-04-12 23:32     ` Qu Wenruo
2022-04-13 13:46       ` David Sterba
2022-04-13 23:23         ` Qu Wenruo
2022-04-15  6:28   ` Christoph Hellwig
2022-04-15  7:02     ` Qu Wenruo [this message]
2022-04-15  7:12       ` Christoph Hellwig
2022-04-15  7:14         ` Qu Wenruo
2022-04-24 23:26           ` Qu Wenruo
2022-04-12 12:30 ` [PATCH v2 2/3] btrfs: fix the error handling for submit_extent_page() for btrfs_do_readpage() Qu Wenruo
2022-04-12 12:30 ` [PATCH v2 3/3] btrfs: return correct error number for __extent_writepage_io() Qu Wenruo
2022-04-12 20:42 ` [PATCH v2 0/3] btrfs: vairous bug fixes related to generic/475 failure with subpage cases David Sterba
2022-04-14 19:38   ` David Sterba

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=37226b35-7d5a-dd86-7b20-7a0dfd3b96fc@gmx.com \
    --to=quwenruo.btrfs@gmx.com \
    --cc=hch@infradead.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=wqu@suse.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox