DM-Crypt Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [dm-crypt] luks header on initramfs img fails due to no O_DIRECT support in tmpfs
@ 2014-08-08  7:22 Natanael Copa
  2014-08-08 11:20 ` Milan Broz
  2014-08-08 13:38 ` Milan Broz
  0 siblings, 2 replies; 3+ messages in thread
From: Natanael Copa @ 2014-08-08  7:22 UTC (permalink / raw)
  To: gmazyland; +Cc: dm-crypt

Hi,

I found this posting while looking at an issue with cryptsetup-1.6.5 in initramfs:
http://www.saout.de/pipermail/dm-crypt/2014-August/004227.html

I believe this is same thing as reported here:
http://bugs.alpinelinux.org/issues/3281

Seems like the problem is that open(2) does not support O_DIRECT when on tmpfs.

I don't subscribe to your mailing list but wanted to share anyways.

Thanks!

-nc

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dm-crypt] luks header on initramfs img fails due to no O_DIRECT support in tmpfs
  2014-08-08  7:22 [dm-crypt] luks header on initramfs img fails due to no O_DIRECT support in tmpfs Natanael Copa
@ 2014-08-08 11:20 ` Milan Broz
  2014-08-08 13:38 ` Milan Broz
  1 sibling, 0 replies; 3+ messages in thread
From: Milan Broz @ 2014-08-08 11:20 UTC (permalink / raw)
  To: Natanael Copa; +Cc: dm-crypt

On 08/08/2014 09:22 AM, Natanael Copa wrote:
> I found this posting while looking at an issue with cryptsetup-1.6.5 in initramfs:
> http://www.saout.de/pipermail/dm-crypt/2014-August/004227.html
> 
> I believe this is same thing as reported here:
> http://bugs.alpinelinux.org/issues/3281
> 
> Seems like the problem is that open(2) does not support O_DIRECT when on tmpfs.

Yes, I expected something like that.

In cryptsetup 1.6.4 this was not happening because it was hidden by temporary dmcrypt
device in the middle of stack.

It is kernel bug, O_DIRECT should work on tmpfs and similar devices.

Anyway, it should also work on older kernels, so I'll think about implementing
some workaround here.

Thanks,
Milan

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dm-crypt] luks header on initramfs img fails due to no O_DIRECT support in tmpfs
  2014-08-08  7:22 [dm-crypt] luks header on initramfs img fails due to no O_DIRECT support in tmpfs Natanael Copa
  2014-08-08 11:20 ` Milan Broz
@ 2014-08-08 13:38 ` Milan Broz
  1 sibling, 0 replies; 3+ messages in thread
From: Milan Broz @ 2014-08-08 13:38 UTC (permalink / raw)
  To: Natanael Copa; +Cc: dm-crypt

On 08/08/2014 09:22 AM, Natanael Copa wrote:
> Hi,
> 
> I found this posting while looking at an issue with cryptsetup-1.6.5 in initramfs:
> http://www.saout.de/pipermail/dm-crypt/2014-August/004227.html
> 
> I believe this is same thing as reported here:
> http://bugs.alpinelinux.org/issues/3281
> 
> Seems like the problem is that open(2) does not support O_DIRECT when on tmpfs.
> 
> I don't subscribe to your mailing list but wanted to share anyways.

BTW I see patch removing O_DIRECT completely in your distro.

As you already mentioned in comment in link above, please do not do this.
You are risking data corruption in some situations.
Using direct-io should ensure that block device is really updated
(And also we really do not want to cache keyslot content in memory.)

I know it is not 100% solution but the best way is to report the problem
here and then backport upstream fix.

(Just use existing device_open() which tries to open device twice, also no need
to patch old code which do not fail. See upstream commit, I also added
test for tmpfs to not repeat the problem again in future.)

Thanks,
Milan

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-08-08 13:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-08  7:22 [dm-crypt] luks header on initramfs img fails due to no O_DIRECT support in tmpfs Natanael Copa
2014-08-08 11:20 ` Milan Broz
2014-08-08 13:38 ` Milan Broz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox