From: Mike Snitzer <snitzer@redhat.com>
To: Eric Ren <zren@suse.com>
Cc: jtang@suse.com, dm-devel@redhat.com, neilb@suse.com,
agk@redhat.com, Zdenek Kabelac <zkabelac@redhat.com>
Subject: Re: dm mirror: fix crash caused by NULL-pointer dereference
Date: Mon, 26 Jun 2017 10:37:24 -0400 [thread overview]
Message-ID: <20170626143723.GA31713@redhat.com> (raw)
In-Reply-To: <a2d51150-c820-57b8-f1d1-c39c7576929b@suse.com>
On Mon, Jun 26 2017 at 9:47am -0400,
Eric Ren <zren@suse.com> wrote:
> Hi,
>
> On 06/26/2017 06:55 PM, Eric Ren wrote:
> >Hi Zdenek,
> >
> >
> >On 06/26/2017 05:46 PM, Zdenek Kabelac wrote:
> >>Dne 26.6.2017 v 11:08 Eric Ren napsal(a):
> >>>
> >>[... snip...]
> >>
> >>Hi
> >>
> >>Which kernel version is this ?
> >>
> >>I'd thought we've already fixed this BZ for old mirrors:
> >>https://bugzilla.redhat.com/show_bug.cgi?id=1382382
> >>
> >>There similar BZ for md-raid based mirrors (--type raid1)
> >>https://bugzilla.redhat.com/show_bug.cgi?id=1416099
> >My base kernel version is 4.4.68, but with this 2 latest fixes applied:
> >
> >"""
> >Revert "dm mirror: use all available legs on multiple failures"
> >dm io: fix duplicate bio completion due to missing ref count
>
> I have a confusion about this "dm io..." fix. The fix itself is good.
>
> Without it, a mkfs.ext4 on a mirrored dev whose primary mirror dev
> has failed, will crash the kernel with the discard operation from mkfs.ext4.
> However, mkfs.ext4 can succeed on a healthy mirrored device. This
> is the thing I don't understand, because no matter the mirrored device is
> good or not, there's always a duplicate bio completion before having this
> this fix, thus write_callback() will be called twice, crashing will
> occur on the
> second write_callback():
No, there is only a duplicate bio completion if the error path is taken
(e.g. underlying device doesn't support discard).
> """
> static void write_callback(unsigned long error, void *context)
> {
> unsigned i;
> struct bio *bio = (struct bio *) context;
> struct mirror_set *ms;
> int should_wake = 0;
> unsigned long flags;
>
> ms = bio_get_m(bio)->ms; ====> NULL pointer at the
> duplicate completion
> bio_set_m(bio, NULL);
> """
>
> If no this fix, I expected the DISCARD IO would always crash the
> kernel, but it's not true when
> the mirrored device is good. Hope someone happen to know the reason
> can give some hints ;-P
If the mirror is healthy then only one completion is returned to
dm-mirror (via write_callback). The problem was the error patch wasn't
managing the reference count as needed. Whereas dm-io's normal discard
IO path does.
Mike
next prev parent reply other threads:[~2017-06-26 14:37 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-26 9:08 [PATCH] dm mirror: fix crash caused by NULL-pointer dereference Eric Ren
2017-06-26 9:14 ` Johannes Thumshirn
2017-06-26 10:42 ` Eric Ren
2017-06-26 9:46 ` Zdenek Kabelac
2017-06-26 10:55 ` Eric Ren
2017-06-26 11:49 ` Zdenek Kabelac
2017-06-26 13:43 ` Mike Snitzer
2017-06-26 13:56 ` Eric Ren
2017-06-27 5:47 ` Eric Ren
2017-06-26 13:47 ` [PATCH] " Eric Ren
2017-06-26 14:37 ` Mike Snitzer [this message]
2017-06-26 15:27 ` Eric Ren
2017-06-27 1:46 ` Eric Ren
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=20170626143723.GA31713@redhat.com \
--to=snitzer@redhat.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=jtang@suse.com \
--cc=neilb@suse.com \
--cc=zkabelac@redhat.com \
--cc=zren@suse.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.