From: Qu Wenruo <quwenruo.btrfs@gmx.com>
To: fdmanana@kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: fix btrfs_wait_ordered_range() so that it waits for all ordered extents
Date: Thu, 13 Feb 2020 21:03:15 +0800 [thread overview]
Message-ID: <24d22c13-b799-c6eb-729f-81f3d8423cf8@gmx.com> (raw)
In-Reply-To: <20200213122950.12115-1-fdmanana@kernel.org>
[-- Attachment #1.1: Type: text/plain, Size: 2032 bytes --]
On 2020/2/13 下午8:29, fdmanana@kernel.org wrote:
> From: Filipe Manana <fdmanana@suse.com>
>
> In btrfs_wait_ordered_range() once we find an ordered extent that has
> finished with an error we exit the loop and don't wait for any other
> ordered extents that might be still in progress.
>
> All the users of btrfs_wait_ordered_range() expect that there are no more
> ordered extents in progress after that function returns. So past fixes
> such like the ones from the two following commits:
>
> ff612ba7849964 ("btrfs: fix panic during relocation after ENOSPC before
> writeback happens")
>
> 28aeeac1dd3080 ("Btrfs: fix panic when starting bg cache writeout after
> IO error")
>
> don't work when there are multiple ordered extents in the range.
>
> Fix that by making btrfs_wait_ordered_range() wait for all ordered extents
> even after it finds one that had an error.
>
> Link: https://github.com/kdave/btrfs-progs/issues/228#issuecomment-569777554
> Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: Qu Wenruo <wqu@suse.com>
Thanks,
Qu
> ---
> fs/btrfs/ordered-data.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/fs/btrfs/ordered-data.c b/fs/btrfs/ordered-data.c
> index 4cbb4e082800..ab3711328e7d 100644
> --- a/fs/btrfs/ordered-data.c
> +++ b/fs/btrfs/ordered-data.c
> @@ -686,10 +686,15 @@ int btrfs_wait_ordered_range(struct inode *inode, u64 start, u64 len)
> }
> btrfs_start_ordered_extent(inode, ordered, 1);
> end = ordered->file_offset;
> + /*
> + * If the ordered extent had an error save the error but don't
> + * exit without waiting first for all other ordered extents in
> + * the range to complete.
> + */
> if (test_bit(BTRFS_ORDERED_IOERR, &ordered->flags))
> ret = -EIO;
> btrfs_put_ordered_extent(ordered);
> - if (ret || end == 0 || end == start)
> + if (end == 0 || end == start)
> break;
> end--;
> }
>
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2020-02-13 13:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-13 12:29 [PATCH] Btrfs: fix btrfs_wait_ordered_range() so that it waits for all ordered extents fdmanana
2020-02-13 13:03 ` Qu Wenruo [this message]
2020-02-13 20:13 ` Josef Bacik
2020-02-18 16:00 ` 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=24d22c13-b799-c6eb-729f-81f3d8423cf8@gmx.com \
--to=quwenruo.btrfs@gmx.com \
--cc=fdmanana@kernel.org \
--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