colby gutierrez-kraybill
Notes on creating zeventd for ZFS on Linux.
~/zfsgit@github.com:colbygk/zfs.git, git@github.com:colbygk/spl.gitBuilding SPL requires a non-PREEMPT kernel; the easiest route is to install the kernel-default package and modify /boot/grub/menu.lst to boot this kernel by default.
$ ./configure
$ make
$ sudo make installBuilding ZFS:
$ ./configure --with-spl=/home/colby/zfs/spl-0.6.0-rc4
$ makeFails on:
...
/home/colby/zfs/zfs/module/zfs/../../module/zfs/spa.c:672:14: error: ‘TASKQ_NORECLAIM’ undeclared (first use in this function)
...TASKQ_NORECLAIM is defined in zfs/include/sys/zfs_context.h, which is included in spa.c. This is part of a kernel module build, so the output is not very verbose. To make verbose output:
$ make V=1
...
make -f /usr/src/linux-2.6.34-12/scripts/Makefile.build obj=/home/colby/zfs/zfs/module/zfs
gcc -Wp,-MD,/home/colby/zfs/zfs/module/zfs/../../module/zfs/.spa.o.d -nostdinc -isystem /usr/lib64/gcc/x86_64-suse-linux/4.5/include -I/usr/src/linux-2.6.34-12/arch/x86/include -Iinclude -I/usr/src/linux-2.6.34-12/include -include include/generated/autoconf.h -I/home/colby/zfs/zfs/module/zfs -D__KERNEL__ -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs -fno-strict-aliasing -fno-common -Werror-implicit-function-declaration -Wno-format-security -fno-delete-null-pointer-checks -O2 -m64 -mtune=generic -mno-red-zone -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args -DCONFIG_AS_CFI=1 -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare -mno-sse -mno-mmx -mno-sse2 -mno-3dnow -Wframe-larger-than=2048 -fno-stack-protector -fomit-frame-pointer -fasynchronous-unwind-tables -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -Wno-unused-but-set-variable -DHAVE_SPL -D_KERNEL -DTEXT_DOMAIN=\"zfs-linux-kernel\" -DNDEBUG -include /home/colby/zfs/spl-0.6.0-rc4/spl_config.h -include /home/colby/zfs/zfs/zfs_config.h -I/home/colby/zfs/zfs/include -I/home/colby/zfs/spl-0.6.0-rc4/include -I/home/colby/zfs/spl-0.6.0-rc4 -DMODULE -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(spa)" -D"KBUILD_MODNAME=KBUILD_STR(zfs)" -D"DEBUG_HASH=32" -D"DEBUG_HASH2=7" -c -o /home/colby/zfs/zfs/module/zfs/../../module/zfs/.tmp_spa.o /home/colby/zfs/zfs/module/zfs/../../module/zfs/spa.c
...On the same command line, add -save-temps. Looks like __KERNEL__ is defined during this part of the build, hiding the rest of the file away when building spa.c. Sending question to maintainer…
Response from developer: needed to check out the latest copy of spl to build against. Did so, and working build now.
The default kernel was installed after the PREEMPT issue found above, but its sources weren’t, so I needed to install a specific devel package:
zypper in kernel-default-devel 2.6.34.8-0.2Install of libraries went to /usr/local/lib; that needs adding to ld.so.conf so that other programs pick them up. Noticed that when running zpool, a new process is opened that does the mount, and it loses LD_LIBRARY_PATH:
# zpool create test1 mirror /dev/sdi /dev/sdj
/sbin/mount.zfs: error while loading shared libraries: libspl.so.0: cannot open shared object file: No such file or directory
cannot mount 'test1': Input/output error# echo "/usr/local/lib" > /etc/ld.so.conf.d/locallib.conf && ldconfig
# zpool destroy -f test1
# zpool create test1 mirror /dev/sdi /dev/sdj
# zpool list
NAME SIZE ALLOC FREE CAP DEDUP HEALTH ALTROOT
test1 696G 84K 696G 0% 1.00x ONLINE -
# zpool status
pool: test1
state: ONLINE
scan: none requested
config:
NAME STATE READ WRITE CKSUM
test1 ONLINE 0 0 0
mirror-0 ONLINE 0 0 0
sdi ONLINE 0 0 0
sdj ONLINE 0 0 0
errors: No known data errors