From: Muthu Kumar <muthu.lkml@gmail.com>
To: Chris Mason <clm@fb.com>
Cc: "kmo@daterainc.com" <kmo@daterainc.com>,
"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>,
"fengguang.wu@intel.com" <fengguang.wu@intel.com>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"lkp@linux.intel.com" <lkp@linux.intel.com>,
"axboe@kernel.dk" <axboe@kernel.dk>,
"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: [block:for-3.14/core] kernel BUG at fs/bio.c:1748
Date: Tue, 7 Jan 2014 13:23:04 -0800 [thread overview]
Message-ID: <CAFR8ueezG4U5ULcp0ayhY690RUE7280UL68d55+tGCqDW9A1Kg@mail.gmail.com> (raw)
In-Reply-To: <1389126617.23310.19.camel@ret.masoncoding.com>
Chris,
This is based off of Jens block tree, for-3.14/core branch...
Regards,
Muthu
On Tue, Jan 7, 2014 at 12:29 PM, Chris Mason <clm@fb.com> wrote:
> On Tue, 2014-01-07 at 12:15 -0800, Muthu Kumar wrote:
>> Thanks Fengguang. Final patch with added comment. BTW, fengguang
>> mentioned that git-am has trouble with the inline patch and "quilt
>> import" worked fine for him...
>>
>> ------------
>> In btrfs_end_bio(), we increment bi_remaining if is_orig_bio. If not,
>> we restore the orig_bio but failed to increment bi_remaining for
>> orig_bio, which triggers a BUG_ON later when bio_endio is called. Fix
>> is to increment bi_remaining when we restore the orig bio as well.
>>
>
> Hi everyone,
>
> Which git tree is this against? Just Jens or some extra code too?
>
> I'll run some tests here. My original patch is below (it's slightly
> different from Muthu's).
>
> Btrfs is sometimes calling bio_endio twice on the same bio while
> we chain things. This makes sure we don't trip over new assertions in
> fs/bio.c
>
> Signed-off-by: Chris Mason <clm@fb.com>
>
> diff --git a/fs/btrfs/check-integrity.c b/fs/btrfs/check-integrity.c
> index 7fcac70..5b30360 100644
> --- a/fs/btrfs/check-integrity.c
> +++ b/fs/btrfs/check-integrity.c
> @@ -2289,6 +2289,10 @@ static void btrfsic_bio_end_io(struct bio *bp, int bio_error_status)
> block = next_block;
> } while (NULL != block);
>
> + /*
> + * since we're not using bio_endio here, we don't need to worry about
> + * the remaining count
> + */
> bp->bi_end_io(bp, bio_error_status);
> }
>
> diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c
> index 62176ad..786ddac 100644
> --- a/fs/btrfs/disk-io.c
> +++ b/fs/btrfs/disk-io.c
> @@ -1684,7 +1684,7 @@ static void end_workqueue_fn(struct btrfs_work *work)
> bio->bi_private = end_io_wq->private;
> bio->bi_end_io = end_io_wq->end_io;
> kfree(end_io_wq);
> - bio_endio(bio, error);
> + bio_endio_nodec(bio, error);
> }
>
> static int cleaner_kthread(void *arg)
> diff --git a/fs/btrfs/volumes.c b/fs/btrfs/volumes.c
> index ef48947..a31448f 100644
> --- a/fs/btrfs/volumes.c
> +++ b/fs/btrfs/volumes.c
> @@ -5284,9 +5284,17 @@ static void btrfs_end_bio(struct bio *bio, int err)
> }
> }
>
> - if (bio == bbio->orig_bio)
> + if (bio == bbio->orig_bio) {
> is_orig_bio = 1;
>
> + /*
> + * eventually we will call the bi_endio for the original bio,
> + * make sure that we've properly bumped bi_remaining to reflect
> + * our chain of endios here
> + */
> + atomic_inc(&bio->bi_remaining);
> + }
> +
> if (atomic_dec_and_test(&bbio->stripes_pending)) {
> if (!is_orig_bio) {
> bio_put(bio);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
next prev parent reply other threads:[~2014-01-07 21:23 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-02 5:31 [block:for-3.14/core] kernel BUG at fs/bio.c:1748 fengguang.wu
2014-01-03 19:51 ` Muthu Kumar
2014-01-05 9:46 ` Fengguang Wu
2014-01-05 16:28 ` Muthu Kumar
2014-01-06 2:21 ` Fengguang Wu
2014-01-06 22:10 ` Kent Overstreet
2014-01-07 0:47 ` Muthu Kumar
2014-01-07 2:52 ` Kent Overstreet
2014-01-07 5:53 ` Fengguang Wu
2014-01-07 20:15 ` Muthu Kumar
2014-01-07 20:29 ` Chris Mason
2014-01-07 21:23 ` Muthu Kumar [this message]
2014-01-08 19:41 ` Chris Mason
2014-01-08 19:54 ` Muthu Kumar
2014-01-08 20:16 ` Chris Mason
2014-01-08 20:40 ` Muthu Kumar
2014-01-08 20:51 ` Chris Mason
2014-01-08 21:01 ` Muthu Kumar
2014-01-08 21:11 ` Chris Mason
2014-01-08 21:14 ` Kent Overstreet
2014-01-08 21:18 ` Muthu Kumar
2014-01-08 21:24 ` Kent Overstreet
2014-01-08 21:13 ` Chris Mason
2014-01-08 21:21 ` Jens Axboe
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=CAFR8ueezG4U5ULcp0ayhY690RUE7280UL68d55+tGCqDW9A1Kg@mail.gmail.com \
--to=muthu.lkml@gmail.com \
--cc=axboe@kernel.dk \
--cc=clm@fb.com \
--cc=fengguang.wu@intel.com \
--cc=kmo@daterainc.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@linux.intel.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;
as well as URLs for NNTP newsgroup(s).