History log of /dflybsd-src/sys/dev/disk/dm/device-mapper.c (Results 1 – 25 of 58)
Revision Date Author Comments
# 9d275733 22-Dec-2019 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Refactor dmioctl()

More readable without dm_ioctl_switch() as a separate function.
taken-from: NetBSD


# 8a5197dd 18-Mar-2018 Matthew Dillon <dillon@apollo.backplane.com>

dm - synchronize disk info before returning

* DM now issues a disk_config(NULL) after setting up the disk info
in order to wait for the probe to complete, otherwise callers
may race trying to op

dm - synchronize disk info before returning

* DM now issues a disk_config(NULL) after setting up the disk info
in order to wait for the probe to complete, otherwise callers
may race trying to open() the disk device before it is actually
ready.

* Fixes cryptsetup luksOpen errors which occur due to probe races,
typically when used in a VM or qemu.

Reported-by: Aaron LI

show more ...


# 00e94364 26-Nov-2016 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Cleanups

This part is unclear for no reason.


# 28d082dd 09-Oct-2016 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Make dmdebug() print __func__

and fix/remove dmdebug calls that could be cleaned up or simplified.


# 2ca88594 01-Oct-2016 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Remove default:break for switch enums on kldload

This could be reverted as compilers may warn if not all enum elements
are covered, but some dm targets don't have default case on lo

sys/dev/disk/dm: Remove default:break for switch enums on kldload

This could be reverted as compilers may warn if not all enum elements
are covered, but some dm targets don't have default case on loading,
and it's been working. Compiles with LINT64.

show more ...


# 338bb82b 21-Sep-2016 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Remove #if0'd dmminphys() from NetBSD

This is specific to NetBSD, so we can remove this.


# 0b985ce1 21-Sep-2016 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Cleanup


# 963efb75 01-May-2016 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Remove read/write support for /dev/mapper/control

It's obvious that /dev/mapper/control has nothing to read/write.
Running below results in kernel panic as the code requires properl

sys/dev/disk/dm: Remove read/write support for /dev/mapper/control

It's obvious that /dev/mapper/control has nothing to read/write.
Running below results in kernel panic as the code requires properly
initialized a per-table lock while this chrdev has no tables mapped.
(control chrdev and dm blkdevs use the same dm device structures)

-----
[root@]~# cat ./dm1.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
int main(void)
{
int fd;
char buf[1024];
fd = open("/dev/mapper/control", O_RDWR);
if (fd == -1) {
perror("open");
exit(1);
}
if (read(fd, buf, sizeof(buf)) == -1)
perror("read");
if (write(fd, buf, sizeof(buf)) == -1)
perror("write");
close(fd);
return 0;
}

With this commit.
-----
[root@]~# uname
DragonFly
[root@]~# kldload dm
[root@]~# ls -l /dev/mapper/control
crw-r----- 1 root operator 65, 0x00000000 May 1 09:25 /dev/mapper/control
[root@]~# gcc -Wall -g ./dm1.c -o ./dm1
[root@]~# ./dm1
read: Operation not supported by device
write: Operation not supported by device

With Linux kernel.
-----
[root@localhost]~# uname
Linux
[root@localhost]~# ls -l /dev/mapper/control
crw-rw---- 1 root root 10, 236 Apr 25 12:44 /dev/mapper/control
[root@localhost]~# gcc -Wall -g ./dm1.c -o ./dm1
[root@localhost]~# ./dm1
read: Invalid argument
write: Invalid argument

show more ...


# 30ef4508 17-Nov-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Cleanup header includes


# b7c11cda 13-Nov-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Cleanups

* Fix comments.
* Add a blank line between functions.
* Some minor fixes on dm core.


# 53a07f3a 11-Nov-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Add a comment on race on unload

There is a minor race window in dm_modcmd() after the below
conditional on unloading dm.ko. It's possible to create a new
device after it gets beyond

sys/dev/disk/dm: Add a comment on race on unload

There is a minor race window in dm_modcmd() after the below
conditional on unloading dm.ko. It's possible to create a new
device after it gets beyond the conditional with 0.

if (dm_dev_counter > 0)
return EBUSY;

Running the below a.sh and then b.sh concurrently causes
kernel panic. Avoiding this race seems to be difficult using
the existing locks that are all file local ones. The panic
can be reproduced with or without the previous commit.

===== a.sh
#!/usr/local/bin/bash
while [ 1 ]; do
kldload dm
kldunload dm
done

===== b.sh
#!/usr/local/bin/bash
kldload dm
while [ 1 ]; do
dmsetup create zero1 --table '0 100 zero'
dmsetup remove /dev/mapper/zero1
done

show more ...


# 26798264 09-Nov-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Rename aprint_debug() to dmdebug()

Not sure what aprint is, but dmdebug() is better considering
this macro does
if (dm_debug_level) kprintf(...);


# 1849c72c 09-Nov-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Add dm_alloc_string()

Add dm_alloc_string() which kmallocs char* from M_DM.

It was confusing that targets had to use M_DM for status
purpose while targets had their own M_DMXXX. Us

sys/dev/disk/dm: Add dm_alloc_string()

Add dm_alloc_string() which kmallocs char* from M_DM.

It was confusing that targets had to use M_DM for status
purpose while targets had their own M_DMXXX. Using this
wrapper function makes target code less error prone when
allocating a string without an extra comment on usage.

show more ...


# a14e8f30 04-Nov-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Remove redundant kprintf in dm strategy

Having two kprintf("------...\n"); before and after debug
messages is redundant since they mostly end up printing
two consecutive lines. One

sys/dev/disk/dm: Remove redundant kprintf in dm strategy

Having two kprintf("------...\n"); before and after debug
messages is redundant since they mostly end up printing
two consecutive lines. One of them could be removed.

show more ...


# 3cd1dc08 24-Oct-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Change table SLIST to TAILQ

TAILQ is more flexible and better for what it's trying to do.


# 0338193e 24-Oct-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Remove unnecessary ()


# 9842ce30 20-Oct-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Remove aprint_normal()

This is a macro for kprintf, but dm and targets basically
never use this except for a few. There isn't really any
point to keep macro version of kprintf, so g

sys/dev/disk/dm: Remove aprint_normal()

This is a macro for kprintf, but dm and targets basically
never use this except for a few. There isn't really any
point to keep macro version of kprintf, so get rid of it.

show more ...


# 1a584652 20-Oct-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Don't expose cmd_function in header

This struct is necessary only for core part of ioctl where
it needs to translate C string to an appropriate handler.
It just doesn't need to expo

sys/dev/disk/dm: Don't expose cmd_function in header

This struct is necessary only for core part of ioctl where
it needs to translate C string to an appropriate handler.
It just doesn't need to expose everything in dm.h.

show more ...


# f9751b33 18-Oct-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Remove NULL element for array termination


# dddde3e1 18-Oct-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Remove dm_get_version_ioctl()

"version" command is done by userspace (Linux lvm2),
so we really don't need to have any handler for this.


# cec31096 12-Oct-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Cleanup DIOCGPART related code


# 033bbf9e 11-Oct-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Refactor dmioctl()

Get rid of if-nest and goto.
This function can be implemented without if-nest and goto,
and this is way easier to understand without lots of comments.


# 7350b8b6 10-Oct-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Remove unused prototype and wrong comments


# a370741a 01-Oct-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Fix typos/etc in kprintf

* Fix typos
* Add missing \n
* Remove \n from \n\n
* Remove unnecessary ' '


# 903c3618 01-Oct-2015 Tomohiro Kusumi <kusumi.tomohiro@gmail.com>

sys/dev/disk/dm: Conform to style(9)


123