devicemapper-rs
A library wrapping Linux's devicemapper ioctls (does not use libdm).
Development status
BETA, feature complete but needs testing.
Documentation
How to contribute
GitHub is used for pull requests and issue tracking.
GitHub is used for pull requests and issue tracking.
This PR includes a bunch of changes.
ThinPoolDev::new()
and setup()
thin_check
in ThinPoolDev::setup()
conditional on the device being unknown to the kernel.DM::parse_table_status()
since the method prefers to panic in all cases where it might otherwise return an error.DM::parse_table_status()
.It addresses #120 but can not be certainly said to fix it, due to the uncertainty of what it means to be "in use".
When loading a verity table the device must be a readonly. The dm driver requires the flags for the DM_TABLE_LOAD_CMD
ioctl to include at least DM_READONLY
- otherwise it complains:
May 25 19:32:42 XXX kernel: [ 7763.805044] device-mapper: table: 254:7: verity: Device must be readonly
May 25 19:32:42 XXX kernel: [ 7763.805049] device-mapper: ioctl: error adding target to table
Add core::dm::table_load_flags
that enables any user to pass DmFlags::DM_READONLY
to the DM_TABLE_LOAD_CMD
operation.
An Option could be to extend table_load
with an Option<DmFlags>
. This changes the API in a breaking way, so I decided to add table_load_flags
. Let me know if you prefer the Option
argument.
It's possible that other options than DM_READONLY
are allowed for the DM_TABLE_LOAD
. Would be easy to add to allowed_flags
.
Resolves: #229. Resolves: #230. Resolves: #244.
Expected to supercede #239.
u64::from
when converting a usize to a u64.Should be a lot tidier.
Signed-off-by: mulhern [email protected]
This branch adds support for udev synchronization using SysV semaphores and the device-mapper ioctl/uevent "cookie" mechanism.
The branch adds a new sub-module, dm_udev_sync
that wraps the low-level semaphore operations and provides an interface to core::dm
.
All udev synchronization is carried out insde DM::do_ioctl()
. This centralises and simplifies handling ioctl errors (which require the udev semaphore to be cleaned up before propagating the error) and minimises the changes needed to synchronize with uevents.
This branch also adds basic logging infrastructure to the crate, using the log facade and the env_logger crate: this was helpful in developing and debugging the udev interactions and may be useful for debugging other problems involving device-mapper.
There are situations where it would be useful to have more insight into the low-level operations being carried out in devicemapper-rs. This is especially the case with the work to implement udev cookie semaphore support where it is often necessary to correlate events in the test (and the cookie values they generate) with the system udev logs.
While it's possible to get so far with println!()
it would be very helpful to at least have the option of enabling straightforward, timestamped logs for the critical interactions with other subsystems.
This should follow the log pattern for a library crate permitting users of the crate to configure whatever concrete logger is needed.
Related https://github.com/stratis-storage/project/issues/335
Before destroying a device-mapper device, devicemapper-rs should delete the symlink for that device under /dev/mapper
. This avoids race conditions by ensuring that opening /dev/mapper/somedevice
always returns the correct device if it succeeds.
This includes all the DmCookie constants and also the 16 bit left shift in to_ioctl_hdr()
which is really DM_UDEV_FLAGS_SHIFT
.
See https://github.com/stratis-storage/devicemapper-rs/blob/master/CHANGES.txt
See https://github.com/stratis-storage/devicemapper-rs/blob/master/CHANGES.txt
See https://github.com/stratis-storage/devicemapper-rs/blob/master/CHANGES.txt
See https://github.com/stratis-storage/devicemapper-rs/blob/master/CHANGES.txt
See https://github.com/stratis-storage/devicemapper-rs/blob/patch-0.29.2/CHANGES.txt
See https://github.com/stratis-storage/devicemapper-rs/blob/master/CHANGES.txt