From: Ming Lei <ming.lei@redhat.com>
To: Johannes Thumshirn <jthumshirn@suse.de>
Cc: dsterba@suse.cz, Dmitriy Gorokh <dmitriy.gorokh@gmail.com>,
linux-btrfs@vger.kernel.org
Subject: Re: [PATCH v2] btrfs: raid56: data corruption on a device removal
Date: Fri, 11 Jan 2019 17:26:29 +0800 [thread overview]
Message-ID: <20190111092628.GB6265@ming.t460p> (raw)
In-Reply-To: <7e1204a4-ed81-7989-f479-f1ee9d0dfd64@suse.de>
On Fri, Jan 11, 2019 at 09:08:27AM +0100, Johannes Thumshirn wrote:
> On 10/01/2019 17:49, Johannes Thumshirn wrote:
> > Right, but we're looking for the number of already completed bytes to
> > rewind here, so from bvec.h's docs it is bi_bvec_done.
> >
> > Dmitriy can you see if this works for you:
> >
> > diff --git a/fs/btrfs/raid56.c b/fs/btrfs/raid56.c
> > index e74455eb42f9..2d0e2eec5413 100644
> > --- a/fs/btrfs/raid56.c
> > +++ b/fs/btrfs/raid56.c
> > @@ -1350,6 +1350,7 @@ static int find_bio_stripe(struct btrfs_raid_bio
> > *rbio,
> > struct btrfs_bio_stripe *stripe;
> >
> > physical <<= 9;
> > + physical -= bio->bi_iter.bi_bvec_done;
>
> OK talked to Hannes about this issue, he says the only way is to save
> the iterator state before submitting the bio.
>
> So the above is bogus too.
>
> This also is what Kent said in
> https://marc.info/?l=linux-block&m=153549921116441&w=2
Yeah, .bi_bvec_done can't help, seems you need to take the similar
approach in 7759eb23fd9808a2e ("block: remove bio_rewind_iter()").
In theory, the follow way might work, but still like a hack:
#define BVEC_ITER_ALL_INIT (struct bvec_iter) \
{ \
.bi_sector = 0, \
.bi_size = UINT_MAX, \
.bi_idx = 0, \
.bi_bvec_done = 0, \
}
old_bi_sector = bio->bi_iter.bi_sector;
bio->bi_iter = BVEC_ITER_ALL_INIT;
bio->bi_iter.bi_sector = old_bi_sector;
bio_advance(bio, where_to_rewind);
This bio can't be the fast-cloned one, which should be satisfied
by fs code.
Also 'where_to_rewind' needs to point to the offset relative to start
of this bio.
Thanks,
Ming
prev parent reply other threads:[~2019-01-11 9:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-12 0:25 [PATCH] btrfs: raid56: data corruption on a device removal Dmitriy Gorokh
2018-12-12 9:09 ` Johannes Thumshirn
2018-12-12 15:53 ` David Sterba
2018-12-14 17:48 ` [PATCH v2] " Dmitriy Gorokh
2018-12-26 0:15 ` Liu Bo
2019-01-04 16:49 ` David Sterba
2019-01-07 11:03 ` Johannes Thumshirn
2019-01-07 15:34 ` David Sterba
2019-01-10 16:49 ` Johannes Thumshirn
2019-01-11 8:08 ` Johannes Thumshirn
2019-01-11 9:26 ` Ming Lei [this message]
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=20190111092628.GB6265@ming.t460p \
--to=ming.lei@redhat.com \
--cc=dmitriy.gorokh@gmail.com \
--cc=dsterba@suse.cz \
--cc=jthumshirn@suse.de \
--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).