From: Omar Sandoval <osandov@osandov.com>
To: Liu Bo <bo.li.liu@oracle.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH 1/7] Btrfs: fix blk_status_t/errno confusion
Date: Wed, 23 Aug 2017 12:18:19 -0700 [thread overview]
Message-ID: <20170823191819.GB15578@vader> (raw)
In-Reply-To: <20170823161340.GA1522@dhcp-10-211-47-181.usdhcp.oraclecorp.com>
On Wed, Aug 23, 2017 at 10:13:40AM -0600, Liu Bo wrote:
> On Tue, Aug 22, 2017 at 11:45:59PM -0700, Omar Sandoval wrote:
> > From: Omar Sandoval <osandov@fb.com>
> >
> > This fixes several instances of blk_status_t and bare errno ints being
> > mixed up, some of which are real bugs.
> >
> > Fixes: 4e4cbee93d56 ("block: switch bios to blk_status_t")
> > Signed-off-by: Omar Sandoval <osandov@fb.com>
> > ---
> > fs/btrfs/disk-io.c | 4 ++--
> > fs/btrfs/inode.c | 70 +++++++++++++++++++++++++++++-------------------------
> > fs/btrfs/raid56.c | 34 +++++++++++++-------------
> > fs/btrfs/volumes.c | 10 ++++----
> > fs/btrfs/volumes.h | 6 ++---
> > 5 files changed, 64 insertions(+), 60 deletions(-)
> >
> > diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> > index 080e2ebb8aa0..f45b61fe9a9a 100644
> > --- a/fs/btrfs/disk-io.c
> > +++ b/fs/btrfs/disk-io.c
> > @@ -3516,7 +3516,7 @@ static blk_status_t wait_dev_flush(struct btrfs_device *device)
> > struct bio *bio = device->flush_bio;
> >
> > if (!device->flush_bio_sent)
> > - return 0;
> > + return BLK_STS_OK;
> >
> > device->flush_bio_sent = 0;
> > wait_for_completion_io(&device->flush_wait);
> > @@ -3563,7 +3563,7 @@ static int barrier_all_devices(struct btrfs_fs_info *info)
> > continue;
> >
> > write_dev_flush(dev);
> > - dev->last_flush_error = 0;
> > + dev->last_flush_error = BLK_STS_OK;
> > }
> >
> > /* wait for all the barriers */
> > diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
> > index 95c212037095..24bcd5cd9cf2 100644
> > --- a/fs/btrfs/inode.c
> > +++ b/fs/btrfs/inode.c
> > @@ -7924,11 +7924,12 @@ static int btrfs_get_blocks_direct(struct inode *inode, sector_t iblock,
> > return ret;
> > }
> >
> > -static inline int submit_dio_repair_bio(struct inode *inode, struct bio *bio,
> > - int mirror_num)
> > +static inline blk_status_t submit_dio_repair_bio(struct inode *inode,
> > + struct bio *bio,
> > + int mirror_num)
> > {
> > struct btrfs_fs_info *fs_info = btrfs_sb(inode->i_sb);
> > - int ret;
> > + blk_status_t ret;
> >
> > BUG_ON(bio_op(bio) == REQ_OP_WRITE);
> >
>
> In this function, there is btrfs_map_bio() who returns 0 or error
> code, errno_to_blk_status() is also needed for that conversion.
See below, btrfs_map_bio() returns blk_status_t now.
> With that,
>
> Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Thanks!
> > diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> > index e8b9a269fdde..bd679bc7a1a9 100644
> > --- a/fs/btrfs/volumes.c
> > +++ b/fs/btrfs/volumes.c
> > @@ -6212,8 +6212,8 @@ static void bbio_error(struct btrfs_bio *bbio, struct bio *bio, u64 logical)
> > }
> > }
> >
> > -int btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
> > - int mirror_num, int async_submit)
> > +blk_status_t btrfs_map_bio(struct btrfs_fs_info *fs_info, struct bio *bio,
> > + int mirror_num, int async_submit)
next prev parent reply other threads:[~2017-08-23 19:18 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-23 6:45 [PATCH 0/7] Btrfs: bugs found by sparse and RCU strings Omar Sandoval
2017-08-23 6:45 ` [PATCH 1/7] Btrfs: fix blk_status_t/errno confusion Omar Sandoval
2017-08-23 15:50 ` David Sterba
2017-08-23 16:13 ` Liu Bo
2017-08-23 19:18 ` Omar Sandoval [this message]
2017-08-23 6:46 ` [PATCH 2/7] Btrfs: fix incorrect {node,sector}size endianness from BTRFS_IOC_FS_INFO Omar Sandoval
2017-09-06 14:51 ` David Sterba
2017-08-23 6:46 ` [PATCH 3/7] Move Btrfs RCU string to common library Omar Sandoval
2017-09-06 15:15 ` David Sterba
2017-09-07 17:10 ` Omar Sandoval
2017-08-23 6:46 ` [PATCH 4/7] Btrfs: refactor btrfs_device->name updates Omar Sandoval
2017-08-23 6:46 ` [PATCH 5/7] Btrfs: fix suspicious RCU in BTRFS_IOC_DEV_INFO Omar Sandoval
2017-09-06 15:37 ` David Sterba
2017-09-07 17:24 ` Omar Sandoval
2017-08-23 6:46 ` [PATCH 6/7] Btrfs: make some volumes.c functions static Omar Sandoval
2017-09-06 15:25 ` David Sterba
2017-08-23 6:46 ` [PATCH 7/7] Btrfs: fix __user casting in ioctl.c Omar Sandoval
2017-09-06 15:23 ` 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=20170823191819.GB15578@vader \
--to=osandov@osandov.com \
--cc=bo.li.liu@oracle.com \
--cc=kernel-team@fb.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).