[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: [dm-devel] NetBSD libdevmapper port
If you are rewriting it --- have you somehow thought about avoiding
A big source of problems in Linux is, that when you suspend a device, you
can do only a limited set of calls --- basically, you must avoid anything
that could possibly wait for I/O or allocate memory --- or you might end
up waiting for the suspended device and deadlock. And I know still about 3
places in kernel that have this error possibility.
A Linux LVM does something like: suspend old table, write to disk with
direct i/o, resume new table. I'd suggest that you invent some method how
to batch these operations into single syscall --- or you run into a
several years of deadlock problems on NetBSD --- basically, on Linux, we
have to preallocate a stack and heap (so that running LVM process won't
cause a page fault --- the question --- how to do it portably on all
NetBSD architectures?), mlock the process, make sure that we don't open
files or write anything to terminal while suspended, make sure that the
ioctl syscall doesn't allocate anything (currently false, it won't
deadlock but it could randomly fail), make sure that O_DIRECT write
syscall doesn't allocate anything or wait for other I/O (currently it
false, there is a deadlock possibility) ... etc.
--- if you port lvm2 as it is, you'll have to audit (and maybe rewrite)
many parts of NetBSD kernel for not waiting for I/O. If you do it badly,
you'll get deadlocks.
This suspend thing was a big misdesign and if you are writing it from
scratch, try to avoid it.
-----BEGIN PGP SIGNED MESSAGE-----
*** Please keep me on CC when you replying from dm-devel list I'm not
currently subscribed there. ***
My name is Adam Hamsik and this summer I'm working on GSOC project Write and
improve LVM driver. As my task I have rewritten (We can't include GPL
software into NetBSD kernel therefore I have rewritten it from scratch)dm
like driver for NetBSD and ported libdevmapper + lvm2tools to NetBSD. There
are some small differences between
Linux and NetBSD such as:
a) NetBSD doesn't use proc filesystem like linux does.
b) NetBSD has 2 types of devices(when we talk about disk devices) raw and
raw device is char device which allow users directly from device(without
After the first implementation of dm-driver my mentor suggested to
rewrite/clean dm-ioctl interface to be more NetBSD-like. I have implemented
new interface based on proplib library  it is based on work
made by apple . I have added 3 files to libdevmapper
include/netbsd/netbsd-dm.h -> file shared between kernel driver and
lib/ioctl/libdm_netbsd.c -> file with external functions for parsing native
NetBSD proplist dictionaries to
libdevmapper dm_ioctl structure.
lib/ioctl/libdm-nbsd-iface.c -> this is copied/changed libdm-iface.c I found
that number of NetBSD specific changes is
bigger than I can easily #ifdef them, therefore I have added new
NetBSD interface file.
I have created patch against latest release of libdevmapper, it would be
great if we will be able to manage
commiting of this patch to libdevmapper main repo. My patch is currently not
ready to commit, it needs major cleanup, but I thought that it would be good
to let dm developers know about my effort and show my work to them.
My patch is located here , I have uploaded patch against lvm2tools, too.
But it is patch against 2.02.28.
Because there were quite massive changes to lvm2tools in latest releases I
will report lvm2tools again and
merge my changes with latest lvm release.
There is also my BSD licensed device-mapper driver which is located here .
Any suggestions, comments are welcome.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
-----END PGP SIGNATURE-----
dm-devel mailing list
Main Index |
Thread Index |