From: Nikolay Borisov <nborisov@suse.com>
To: Liu Bo <bo.li.liu@oracle.com>, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: fix unexpected return value of bio_readpage_error
Date: Fri, 14 Jul 2017 10:04:58 +0300 [thread overview]
Message-ID: <ea29b0c9-d5b1-7dbb-8e51-6659940b42b3@suse.com> (raw)
In-Reply-To: <20170713220050.22720-1-bo.li.liu@oracle.com>
On 14.07.2017 01:00, Liu Bo wrote:
> With blk_status_t, in bio_readpage_error() may return 1 as now
> ->submit_bio_hook() may not set %ret if it runs without problem.
>
> This fixes that unexpected return value by changing
> btrfs_check_repairable() to return a bool instead of updating %ret.
>
> Signed-off-by: Liu Bo <bo.li.liu@oracle.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
> ---
> fs/btrfs/extent_io.c | 12 ++++++------
> fs/btrfs/extent_io.h | 4 ++--
> 2 files changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c
> index 556484c..098c319 100644
> --- a/fs/btrfs/extent_io.c
> +++ b/fs/btrfs/extent_io.c
> @@ -2258,7 +2258,7 @@ int btrfs_get_io_failure_record(struct inode *inode, u64 start, u64 end,
> return 0;
> }
>
> -int btrfs_check_repairable(struct inode *inode, struct bio *failed_bio,
> +bool btrfs_check_repairable(struct inode *inode, struct bio *failed_bio,
> struct io_failure_record *failrec, int failed_mirror)
> {
> struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
> @@ -2274,7 +2274,7 @@ int btrfs_check_repairable(struct inode *inode, struct bio *failed_bio,
> btrfs_debug(fs_info,
> "Check Repairable: cannot repair, num_copies=%d, next_mirror %d, failed_mirror %d",
> num_copies, failrec->this_mirror, failed_mirror);
> - return 0;
> + return false;
> }
>
> /*
> @@ -2315,10 +2315,10 @@ int btrfs_check_repairable(struct inode *inode, struct bio *failed_bio,
> btrfs_debug(fs_info,
> "Check Repairable: (fail) num_copies=%d, next_mirror %d, failed_mirror %d",
> num_copies, failrec->this_mirror, failed_mirror);
> - return 0;
> + return false;
> }
>
> - return 1;
> + return true;
> }
>
>
> @@ -2382,8 +2382,8 @@ static int bio_readpage_error(struct bio *failed_bio, u64 phy_offset,
> if (ret)
> return ret;
>
> - ret = btrfs_check_repairable(inode, failed_bio, failrec, failed_mirror);
> - if (!ret) {
> + if (!btrfs_check_repairable(inode, failed_bio, failrec,
> + failed_mirror)) {
> free_io_failure(failure_tree, tree, failrec);
> return -EIO;
> }
> diff --git a/fs/btrfs/extent_io.h b/fs/btrfs/extent_io.h
> index 3fb8513..4f03091 100644
> --- a/fs/btrfs/extent_io.h
> +++ b/fs/btrfs/extent_io.h
> @@ -539,8 +539,8 @@ void btrfs_free_io_failure_record(struct btrfs_inode *inode, u64 start,
> u64 end);
> int btrfs_get_io_failure_record(struct inode *inode, u64 start, u64 end,
> struct io_failure_record **failrec_ret);
> -int btrfs_check_repairable(struct inode *inode, struct bio *failed_bio,
> - struct io_failure_record *failrec, int fail_mirror);
> +bool btrfs_check_repairable(struct inode *inode, struct bio *failed_bio,
> + struct io_failure_record *failrec, int fail_mirror);
> struct bio *btrfs_create_repair_bio(struct inode *inode, struct bio *failed_bio,
> struct io_failure_record *failrec,
> struct page *page, int pg_offset, int icsum,
>
next prev parent reply other threads:[~2017-07-14 7:05 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-13 22:00 [PATCH] Btrfs: fix unexpected return value of bio_readpage_error Liu Bo
2017-07-14 7:04 ` Nikolay Borisov [this message]
2017-07-14 12:32 ` David Sterba
2017-07-14 16:30 ` Liu Bo
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=ea29b0c9-d5b1-7dbb-8e51-6659940b42b3@suse.com \
--to=nborisov@suse.com \
--cc=bo.li.liu@oracle.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;
as well as URLs for NNTP newsgroup(s).