From: Mike Snitzer <snitzer@redhat.com>
To: Nikos Tsironis <ntsironis@arrikto.com>
Cc: dm-devel@redhat.com, thornber@redhat.com, agk@redhat.com
Subject: Re: [PATCH 2/2] dm thin: Flush data device before committing metadata
Date: Wed, 4 Dec 2019 11:39:39 -0500 [thread overview]
Message-ID: <20191204163939.GA30305@redhat.com> (raw)
In-Reply-To: <4627d4b3-fced-0d22-34c5-258733c9afa9@arrikto.com>
On Wed, Dec 04 2019 at 11:17am -0500,
Nikos Tsironis <ntsironis@arrikto.com> wrote:
> On 12/4/19 5:27 PM, Joe Thornber wrote:
> >On Wed, Dec 04, 2019 at 04:07:42PM +0200, Nikos Tsironis wrote:
> >>The thin provisioning target maintains per thin device mappings that map
> >>virtual blocks to data blocks in the data device.
> >
> >
> >Ack. But I think we're issuing the FLUSH twice with your patch. Since the
> >original bio is still remapped and issued at the end of process_deferred_bios?
> >
>
> Yes, that's correct. I thought of it and of putting a check in
> process_deferred_bios() to complete FLUSH bios immediately, but I have
> one concern and I preferred to be safe than sorry.
>
> In __commit_transaction() there is the following check:
>
> if (unlikely(!pmd->in_service))
> return 0;
>
> , which means we don't commit the metadata, and thus we don't flush the
> data device, in case the pool is not in service.
>
> Opening a thin device doesn't seem to put the pool in service, since
> dm_pool_open_thin_device() uses pmd_write_lock_in_core().
>
> Can I assume that the pool is in service if I/O can be mapped to a thin
> device? If so, it's safe to put such a check in process_deferred_bios().
In service means upper layer has issued a write to a thin device of a
pool. The header for commit 873f258becca87 gets into more detail.
> On second thought though, in order for a flush bio to end up in
> deferred_flush_bios in the first place, someone must have changed the
> metadata and thus put the pool in service. Otherwise, it would have been
> submitted directly to the data device. So, it's probably safe to check
> for flush bios after commit() in process_deferred_bios() and complete
> them immediately.
Yes, I think so, which was Joe's original point.
> If you confirm too that this is safe, I will send a second version of
> the patch adding the check.
Not seeing why we need another in_service check. After your changes are
applied, any commit will trigger a preceeding flush.. so the deferred
flushes are redundant.
By definition, these deferred bios imply the pool is in service.
I'd be fine with seeing a 3rd follow-on thinp patch that completes the
redundant flushes immediately.
Thanks,
Mike
next prev parent reply other threads:[~2019-12-04 16:39 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-04 14:07 [PATCH 0/2] dm thin: Flush data device before committing metadata to avoid data corruption Nikos Tsironis
2019-12-04 14:07 ` [PATCH 1/2] dm thin metadata: Add support for a pre-commit callback Nikos Tsironis
2019-12-05 19:40 ` Mike Snitzer
2019-12-05 21:33 ` Nikos Tsironis
2019-12-04 14:07 ` [PATCH 2/2] dm thin: Flush data device before committing metadata Nikos Tsironis
2019-12-04 15:27 ` Joe Thornber
2019-12-04 16:17 ` Nikos Tsironis
2019-12-04 16:39 ` Mike Snitzer [this message]
2019-12-04 16:47 ` Nikos Tsironis
2019-12-04 19:58 ` [PATCH 0/2] dm thin: Flush data device before committing metadata to avoid data corruption Eric Wheeler
2019-12-04 20:17 ` Mike Snitzer
2019-12-05 15:31 ` Nikos Tsironis
2019-12-05 15:42 ` Mike Snitzer
2019-12-05 16:02 ` Nikos Tsironis
2019-12-05 22:34 ` Eric Wheeler
2019-12-06 15:14 ` Nikos Tsironis
2019-12-06 20:06 ` Eric Wheeler
2019-12-09 14:25 ` Nikos Tsironis
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=20191204163939.GA30305@redhat.com \
--to=snitzer@redhat.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=ntsironis@arrikto.com \
--cc=thornber@redhat.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.