Re: deadlock when swapping to encrypted swapfile

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 10, 2025 at 04:24:46PM +0100, Robert Beckett wrote:
> I see that dm-loop is very old at this point. Do you know the rationale for rejection?
> was there any hope to get it included with more work?
> If the main objection was regarding file spans that they can't gurantee persist, maybe a new fallocate based
> contrace with the filesystems could aleviate the worries? 

Right: I first wrote it back in 2006. When it fimally made it onto a
mailing list in 2008 the concerns were basically threefold: "why is DM
reinventing everything?", the borrowing of the S_SWAPFILE flag to keep
the file mapping stable while dm-loop goes behind the filesystem's
back, and the greedy population of the extent table (lazily filling the
extent table reduces start up time and the amount of pinned memory, but
has the drawback that the target needs to allocate memory for unmapped
extents while it is running, reintroducing the possibility of deadlock
in low memory situations).

Most of the interesting discussions happened in this thread after Jens
posted an RFC patch taking a similar approach for /dev/loop:

  https://lkml.iu.edu/hypermail/linux/kernel/0801.1/0716.html

This used a prio tree instead of a simple table and binary search.

There have been various different approaches proposed down the years but
none have made it to mainline to date. I wrote one in 2011 that
refactored drivers/block/loop.c so that it could be reused by
device-mapper: that seemed like it might be more acceptable upstream but
we didn't pursue it at the time (it also removes the main benefit for
your case, since it uses the regular loop.c machinery for IO).

The version Mikulas posted is most closely related to a version I was
working on in 2008-9:

  https://www.sourceware.org/pub/dm/patches/2.6-unstable/editing/patches-2.6.31/dm-loop.patch

Which is the one discussed in the thread above - I think roughly the
same objections exist today.

(historical note - dmsetup still has code to generate dm-loop tables if
symlinked to the name 'dmlosetup' or 'losetup':

  # dmlosetup 
  dmlosetup: Please specify loop_device.
  Usage:
  
  dmlosetup [-d|-a] [-e encryption] [-o offset] [-f|loop_device] [file]
  
  Couldn't process command line)

Regards,
Bryn.





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux