stratis-storage/devicemapper-rs

Test sudo_test_create fails on kernel 5.10

mesch001 opened this issue · 7 comments

Hi, when using the crate the test sudo_test_create on commit 6f05139 fails with the following error message:

core::dm::tests::sudo_test_create stdout ----
thread 'core::dm::tests::sudo_test_create' panicked at 'called `Result::unwrap()` on an `Err` value: Core(Ioctl(Some(DeviceInfo { version: Version { major: 4, minor: 43, patch: 0 }, data_size: 16384, data_start: 312, target_count: 0, open_count: 0, flags: (empty), event_nr: 0, dev: Device { major: 0, minor: 0 }, name: Some(DmNameBuf { inner: "example-dev_dm-rs_test_delme" }), uuid: None }), EINVAL))', src/core/dm.rs:826:74
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Altough it is quite outdated on commit b646077 the test succeeded. I haven't tried any newer versions, but can do so if helpful.

Used kernel version:

uname -a
Linux DevStroke 5.10.70-1-MANJARO #1 SMP PREEMPT Thu Sep 30 15:29:01 UTC 2021 x86_64 GNU/Linux

Attached is an strace of the complete test run and dm.ioctl.h of my system
strace.txt
dm-ioctl.h.gz

Is there any more information I can provide?

@mesch001 I'm so glad you reported this because I just bumped into this in a PR that I was developing for stratisd! I'm glad it's not just me. I'll take a look at this next because it's blocking stratis-storage/stratisd#2814. I'll keep you posted.

@mesch001 So far, I've determined that there have been some changes upstream to devicemapper. Could you rerun that test and then provide any dmesg output from devicemapper?

@jbaublitz Sure thing, here is the output:

sudo dmesg | grep device-mapper
[ 1513.446455] device-mapper: ioctl: ioctl interface mismatch: kernel(4.43.0), user(4.44.0), cmd(3)
[ 1513.446457] device-mapper: ioctl: ioctl interface mismatch: kernel(4.43.0), user(4.44.0), cmd(3)

and here is addtionally the version. Assuming that helps:

sudo dmsetup --version
Library version:   1.02.179 (2021-08-11)
Driver version:    4.43.0

@mesch001 Thanks so much! Can you provide the following information?

  • How did you install devicemapper and devicemapper-sys?
  • What operating system are you on?
  • Is the kernel available the most recent in your package manager?

We started autogenerating the devicemapper version from dm-ioctl.h with the addition of the devicemapper-sys crate. This works for installs from crates.io because they are built each time an application uses them, building from the git repo for the same reason, and Fedora because the package will be built against the current kernel version available. The caveats here are that if a kernel version:

  • does not match the kernel headers, the kernel headers need to be fixed and the package needs to be rebuilt
  • is rolled back to an earlier version, the package needs to be rebuilt
  • is earlier than that used in the build system, the package will fail when run on an earlier kernel version

I'd like to get a little bit more information on your particular setup so that @mulkieran and I can think about whether your case warrants rethinking how we're approaching the kernel version.

@jbaublitz: First of all: thank you for responding so fast every time.
I have to admit, I am not quite clear on whether I understood the questions correctly, However I tried to answer them as I understood the intention:

  • The issue initially occured when pulling the crate directly from crates.io (0.3.0), afterwards I pulled the source directly from github to perform the test cases

  • I am on running on manjaro, which is based on Arch Linux.

  • There are newer kernel versions available, the one I am using is the on with LTS. The newer ones are mostly experimental

    • I never messed with the kernel on purpose, so I am not sure if any of the described situations apply to me.

    So currently I don't see an issue with the build process you use currently.
    Whatever information I can provide to you I am more than happy to share.

Hi @mesch001! Happy to help! The last thing I'll need from you is the output of sudo dmsetup version. Based on the error message and the contents of dm_ioctl.h, I'm guessing that the kernel headers and kernel don't match. The version in dm_ioctl.h is indeed 4.44 so if the returned driver version from sudo dmsetup version is 4.43, that would indicate that there is a mismatch between the headers and the kernel.

Hi @jbaublitz: You were right on your analysis. I updated the kernel to the next version and that solved the problem.
Thank you so much for your support.

Closing ticket because issue is solved.