All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sven Eschenberg <sven@whgl.uni-frankfurt.de>
To: dm-crypt@saout.de
Subject: Re: [dm-crypt] The future of disk encryption with LUKS2
Date: Sat, 6 Feb 2016 19:56:02 +0100	[thread overview]
Message-ID: <56B641C2.4070400@whgl.uni-frankfurt.de> (raw)
In-Reply-To: <20160206100140.GU13740@yeono.kjorling.se>

Hi Michael,


Am 06.02.2016 um 11:01 schrieb Michael Kjörling:
> On 6 Feb 2016 04:18 +0100, from sven@whgl.uni-frankfurt.de (Sven Eschenberg):
>> (A secondary header implies that
>> all changes on both headers need to be atomic and in sync. While
>> this is doable, LVM clearly shows, that it is not trivial, otherwise
>> it would certainly be available as feature by now).
>
> I'm not so sure it does imply that. It does certainly imply the need
> to know that a, and which one out of the lot, header is most up to
> date, but that does not necessarily require writes to both to be done
> atomically and in sync. (In fact, truly atomic, in-sync writes to
> multiple distinct locations seems a physical impossibility at least in
> the case of a single spinning disk, since the write head can only be
> in one location at any one time.)

Of course atomicity applies to the transaction as whole. Here atomicity 
implies that before starting and afterwards the state is consistent and 
that if something goes wrong inbetween, you'll be able to cleanly roll 
back or conclude the operation.
>
> This is where the "update counter" and a checksum that I mentioned
> earlier comes in. An example of how to actually do this might be to
> first discard (or perhaps rather, remove from consideration) any
> header which doesn't match its checksum (for integrity purposes), then
> use the one with the highest update counter value (taking care to
> allow for wraparound) as a starting point for the operation at hand,
> then rewrite any previously discarded headers (ideally writing the
> checksum last, such that the header remains considered invalid until
> it has been fully rewritten).

An update counter+checksum will not do the trick. Let's see (This is has 
not been completely thought over and checked) a resize operation that 
grows the container:
The backing device grows, possibly without any warning -> We'll need to 
keep the secondary header location in the primary header.
Check that both headers are consistent, otherwise fix them first.
Add old location and new planned location of the header into the WAL.
Read secondary header, write secondary header (note in WAL, note the 
secondary header at old location will be removed)
safely wipe old header (note in WAL)
Note that primary header's location info on secondary header is about to 
be updated, update and note success in WAL.

Check for consistency & clear WAL.

Hopefully I did not miss any step and yes, it is not THAT complicated as 
there is no concurrency involved, but the transactions for resizing need 
to be crafted carefully.

With a single metadatacopy 90% of the issues don't even exist ;-).

>
> Or maybe even better, rewrite a previously considered invalid header
> (if any) first; that should ensure that as long as the storage itself
> works properly, if any header is ever valid at the beginning of an
> operation, there exists at all times at least one header which is
> valid.
>
> By placing the headers far apart from each other, this forces at least
> spinning disks to seek, which naturally introduces a sequence point
> into the write process; even if the two write requests were to be put
> onto the I/O bus at the same instant, one write must complete before
> the other can physically begin. (Finally, a good use for the seek
> delay in rotational storage!)
>
> This should work equally well for any number of header copies.
>

  parent reply	other threads:[~2016-02-06 18:55 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-03 13:13 [dm-crypt] The future of disk encryption with LUKS2 .. ink ..
2016-02-03 14:02 ` Yves-Alexis Perez
2016-02-03 14:17 ` Milan Broz
2016-02-03 17:07   ` Arno Wagner
2016-02-03 19:46   ` Sven Eschenberg
2016-02-04  8:38     ` Milan Broz
2016-02-04  9:20       ` Michael Kjörling
2016-02-04 10:02         ` Milan Broz
2016-02-04 11:01           ` Arno Wagner
2016-02-04 16:34         ` Sven Eschenberg
2016-02-04 17:23           ` Arno Wagner
2016-02-04 18:42             ` Michael Kjörling
2016-02-04 20:51               ` Sven Eschenberg
2016-02-05 10:56               ` Arno Wagner
2016-02-05 15:08             ` Robert Nichols
2016-02-05 15:57               ` Arno Wagner
2016-02-05 23:51                 ` Sven Eschenberg
2016-02-06  2:58                   ` Arno Wagner
2016-02-06  3:18                     ` Sven Eschenberg
2016-02-06 10:01                       ` Michael Kjörling
2016-02-06 14:29                         ` Arno Wagner
2016-02-06 18:56                         ` Sven Eschenberg [this message]
2016-02-06 19:09                           ` Michael Kjörling
2016-02-06 19:18                             ` Sven Eschenberg
2016-02-07  0:09                               ` Lars Winterfeld
2016-02-07 23:05                               ` Arno Wagner
2016-02-08  0:25                                 ` Sven Eschenberg
2016-02-08 11:34                                   ` Michael Kjörling
2016-02-08 16:57                                     ` Arno Wagner
2016-02-08 20:19                                       ` f-dm-c
2016-02-08 16:41                                   ` Arno Wagner
2016-02-08 17:26                                     ` Sven Eschenberg
2016-02-08 18:49                                       ` Arno Wagner
2016-02-08 19:08                                         ` Sven Eschenberg
2016-02-08 20:31                                     ` f-dm-c
2016-02-08 20:51                                       ` Sven Eschenberg
2016-02-08 21:10                                         ` Arno Wagner
2016-02-08 21:43                                         ` f-dm-c
2016-02-08 22:04                                           ` Sven Eschenberg
2016-02-08 21:08                                       ` Arno Wagner
2016-02-08 21:45                                         ` f-dm-c
2016-02-06 14:20                       ` Arno Wagner
2016-02-06 19:13                         ` Sven Eschenberg
2016-02-07  7:09                       ` f-dm-c
2016-02-07 23:17                         ` Arno Wagner
2016-02-08  0:40                           ` Sven Eschenberg
2016-02-08  2:06                           ` f-dm-c
2016-02-08  2:46                             ` Sven Eschenberg
2016-02-08  3:43                               ` f-dm-c
2016-02-08  4:32                                 ` Sven Eschenberg
2016-02-08  6:09                                   ` f-dm-c
2016-02-08 16:51                                     ` Arno Wagner
2016-02-08 20:05                                       ` f-dm-c
2016-02-08 20:11                                       ` f-dm-c
2016-02-08 20:35                                         ` Sven Eschenberg
2016-02-08 17:27                                     ` Sven Eschenberg
2016-02-08 16:48                                   ` Arno Wagner
2016-02-08 19:49                                     ` f-dm-c
2016-02-08 19:57                                       ` Arno Wagner
2016-02-08 20:05                                       ` Sven Eschenberg
2016-02-04  9:35       ` Sumaya1960
2016-02-04 10:48         ` Arno Wagner
     [not found]           ` <56B4AC42.7070408@gmx.de>
2016-03-01 12:50             ` [dm-crypt] LUKS NVMe M.2 SSD - save disklayout Sumaya1960
2016-03-01 18:18               ` Sven Eschenberg
2016-03-04 22:05                 ` doark
2016-03-10 12:13                   ` Matthias Schniedermeyer
2016-03-14 18:23                   ` Sven Eschenberg
2016-02-04 16:29   ` [dm-crypt] The future of disk encryption with LUKS2 Yves-Alexis Perez
2016-02-04 17:17     ` Arno Wagner
2016-02-05  6:30       ` Yves-Alexis Perez
2016-02-05 11:02         ` Arno Wagner
2016-02-05 13:13           ` Yves-Alexis Perez
2016-02-05 13:31             ` Arno Wagner
2016-02-05 15:01               ` Yves-Alexis Perez
2016-02-05 15:24                 ` Arno Wagner
2016-02-05 15:44                   ` Milan Broz
2016-02-05 19:45                     ` Arno Wagner
2016-02-05 22:43                       ` Arno Wagner
2016-02-05 16:50                   ` Yves-Alexis Perez
2016-02-05 19:53                     ` Arno Wagner
2016-02-05 21:09                       ` Arno Wagner
     [not found]             ` <20160205133123.GA31320@das-labor.org>
2016-02-05 13:49               ` Zaolin
2016-02-05 15:15                 ` Arno Wagner
2016-02-08 21:51   ` Milan Broz
2016-02-08 22:36     ` Sven Eschenberg
2016-02-09  0:27       ` Milan Broz
2016-02-09  1:02     ` Arno Wagner
2016-02-09 22:08     ` Lars Winterfeld
2016-02-09 23:35       ` Arno Wagner
2016-02-10  0:20         ` Sven Eschenberg
2016-02-10  8:37         ` Milan Broz
2016-02-10 11:47           ` Arno Wagner
2016-02-10 13:48           ` Sven Eschenberg
2016-02-10 14:35             ` Robert Nichols
2016-02-10 15:09               ` Sven Eschenberg
2016-02-10 15:39                 ` Milan Broz
2016-02-10 16:22                   ` Arno Wagner
2016-02-10 17:13                     ` Sven Eschenberg
2016-02-10 16:48                   ` Sven Eschenberg
2016-02-11  5:09                 ` Robert Nichols
2016-02-11  6:44                   ` Milan Broz
2016-02-14  8:20             ` Milan Broz
2016-02-14 21:32               ` Sven Eschenberg
2016-03-12 21:20 David Niklas
2016-03-16  6:36 ` Ondrej Kozina
2016-03-25 21:09   ` David Niklas

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=56B641C2.4070400@whgl.uni-frankfurt.de \
    --to=sven@whgl.uni-frankfurt.de \
    --cc=dm-crypt@saout.de \
    /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.