openzfs / zfs

OpenZFS on Linux and FreeBSD
https://openzfs.github.io/openzfs-docs
Other
10.55k stars 1.74k forks source link

2.6.37 kernel support #85

Closed behlendorf closed 13 years ago

behlendorf commented 13 years ago

Currently only 2.6.18-2.6.36 kernels are supported. The 2.6.37 kernel was release on Jan 4th 2011 and will start making its way in to distributions over the next several months. As expected roll your own distribution such as Gentoo are discovering this first, but it's only a matter of time before fedora/ubuntu distributions pick it up.

Currently the build fails as follows, if anyone is interested in working on these issues please drop me an email. If not we'll get to it time permitting.

/var/tmp/portage/sys-fs/zfs-9999/work/zfs-9999/module/zfs/vdev_disk.o
/var/tmp/portage/sys-fs/zfs-9999/work/zfs-9999/module/zfs/vdev_disk.c:
In function 'vdev_disk_physio_completion':
/var/tmp/portage/sys-fs/zfs-9999/work/zfs-9999/module/zfs/vdev_disk.c:261:
error: 'BIO_RW_SYNC' undeclared (first use in this function)
/var/tmp/portage/sys-fs/zfs-9999/work/zfs-9999/module/zfs/vdev_disk.c:261:
error: (Each undeclared identifier is reported only once
/var/tmp/portage/sys-fs/zfs-9999/work/zfs-9999/module/zfs/vdev_disk.c:261:
error: for each function it appears in.)
/var/tmp/portage/sys-fs/zfs-9999/work/zfs-9999/module/zfs/vdev_disk.c:
In function '__vdev_disk_physio':
/var/tmp/portage/sys-fs/zfs-9999/work/zfs-9999/module/zfs/vdev_disk.c:398:
error: 'BIO_RW_SYNC' undeclared (first use in this function)
ICECC[11986] 12:54:09: Compiled on 130.83.163.95
make[5]: ***
[/var/tmp/portage/sys-fs/zfs-9999/work/zfs-9999/module/zfs/vdev_disk.o]
Error 1
make[4]: *** [/var/tmp/portage/sys-fs/zfs-9999/work/zfs-9999/module/zfs]
Error 2
make[3]: ***
[_module_/var/tmp/portage/sys-fs/zfs-9999/work/zfs-9999/module] Fehler 2
make[3]: Leaving directory `/usr/src/linux-2.6.37-thinkpad'
make[2]: *** [modules] Fehler 2
make[2]: Leaving directory
`/var/tmp/portage/sys-fs/zfs-9999/work/zfs-9999/module'
make[1]: *** [all-recursive] Fehler 1
make[1]: Leaving directory `/var/tmp/portage/sys-fs/zfs-9999/work/zfs-9999'
make: *** [all] Fehler 2
emake failed
kimnzl commented 13 years ago

Changes to get it to compile under 2.6.37. These should help some in working out what the issues are. There is at least one proble with the below but this is as far as I can go. I am not familiar enough with kernel drivers to find the cause.


==================================== ZTEST ====================================

5 vdevs, 7 datasets, 23 threads, 300 seconds...
Setting dataset ztest/ds_4 to sync always
Setting dataset ztest/ds_6 to sync always
Pass   1,  SIGKILL,   0 ENOSPC,  3.3% of  476M used,  16% done,    4m10s to go
Pass   2,  SIGKILL,   0 ENOSPC,  3.2% of  476M used,  20% done,    4m01s to go
Setting dataset ztest/temp_14 to sync always
Pass   3,  SIGKILL,   0 ENOSPC,  4.9% of  476M used,  37% done,    3m08s to go
Pass   4,  SIGKILL,   0 ENOSPC,  5.0% of  476M used,  49% done,    2m31s to go
Setting dataset ztest/temp_20 to sync always
Pass   5,  SIGKILL,   0 ENOSPC,  5.7% of  476M used,  65% done,    1m46s to go
Pass   6, Complete,   0 ENOSPC,  7.8% of  476M used, 100% done,       0s to go
5 killed, 1 completed, 83% kill rate

=================================== ZCONFIG ===================================

1    persistent zpool.cache               cannot mount 'test1': No such device
Fail (2)

Caused in part by:
http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.37.y.git;a=commit;h=7cc015811ef8992dfcce314d0ed9642bc18143d1

There needs to be a test for 2.6.37
I am not sure if REQ_WRITE is also needed and to confuse matters they are defined as the enable code.
#define REQ_WRITE               (1 << __REQ_WRITE)
#define REQ_SYNC                (1 << __REQ_SYNC)

nano include/sys/vdev_disk.h
#include <linux/version.h> //for LINUX_VERSION_CODE

/* 2.6.29 API change */
#ifdef HAVE_BIO_RW_SYNCIO
# define DIO_RW_SYNCIO                  (1 << BIO_RW_SYNCIO)
#else
# define DIO_RW_SYNCIO                 (1 << BIO_RW_SYNC)  
#endif /* HAVE_BIO_RW_SYNCIO */

/* 2.6.37 API change */
#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 36)
#undef DIO_RW_SYNCIO
#define DIO_RW_SYNCIO                  ( REQ_WRITE | REQ_SYNC )

nano nano module/zfs/vdev_disk.c
replace all:
(1 << DIO_RW_SYNCIO)
with:
DIO_RW_SYNCIO

from:
http://us.generation-nt.com/patch-staging-spectra-remove-non-existing-blk-fs-request-wrapper-help-199107941.html

nano module/zfs/zvol.c

-   if (!blk_fs_request(req)){
+   if (req->cmd_type != REQ_TYPE_FS){

nano module/zpios/pios.c
#include <linux/version.h> //for LINUX_VERSION_CODE

static struct file_operations zpios_fops = {

#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 35)
    .ioctl        = zpios_ioctl,
#else
    .unlocked_ioctl    = zpios_ioctl,
#endif
behlendorf commented 13 years ago

It doesn't look like your working with the latest version of the code. Please grab the spl/zfs-0.5.2 source and try again. There was a series of 2.6.36 compatibility patches which addressed all of these issues.

1f30b9d432dd48826cd562757d19c2771b0973e8 Linux 2.6.36 compat, use fops unlockedioctl() 8326eb4605a3d7c87cac15d5d11316fb99cd9ab0 Linux 2.6.36 compat, blk* macros removed 675de5aa379bfceb0258a20c4ccd1414e4798ee6 Linux 2.6.36 compat, synchronous bio flag f4af6bb783b0b7f2a6075cb1c74c225db8a157b2 Linux 2.6.36 compat, use REQ_FAILFAST_MASK

Rainmaker52 commented 13 years ago

I'm getting a different error on Debian's 2.6.37-1-amd64 kernel from the code in the released archive at http://github.com/downloads/behlendorf/zfs/zfs-0.6.0-rc1.tar.gz.

I'm getting:

  CC [M]  /home/rainmaker/zfs/zfs-0.6.0-rc1/module/zfs/../../module/zfs/zfs_sa.o
  CC [M]  /home/rainmaker/zfs/zfs-0.6.0-rc1/module/zfs/../../module/zfs/zfs_vfsops.o
/home/rainmaker/zfs/zfs-0.6.0-rc1/module/zfs/../../module/zfs/zfs_vfsops.c: In function ‘zfsvfs_teardown’:
/home/rainmaker/zfs/zfs-0.6.0-rc1/module/zfs/../../module/zfs/zfs_vfsops.c:1083: error: implicit declaration of function ‘invalidate_inodes’
make[7]: *** [/home/rainmaker/zfs/zfs-0.6.0-rc1/module/zfs/../../module/zfs/zfs_vfsops.o] Error 1
make[6]: *** [/home/rainmaker/zfs/zfs-0.6.0-rc1/module/zfs] Error 2
make[5]: *** [_module_/home/rainmaker/zfs/zfs-0.6.0-rc1/module] Error 2
make[4]: *** [sub-make] Error 2
make[3]: *** [all] Error 2
make[3]: Leaving directory `/usr/src/linux-headers-2.6.37-1-amd64'
make[2]: *** [modules] Error 2
make[2]: Leaving directory `/home/rainmaker/zfs/zfs-0.6.0-rc1/module'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/rainmaker/zfs/zfs-0.6.0-rc1'
make: *** [all] Error 2

And, make is right. I cannot find the function ‘invalidate_inodes'.

I got a git checkout, and tried the same thing with the checkout. Same error... The only reference for this function seems to be at zfs_vfsops.c:1083

Thank you for fixxing the configure script for Debian (issue #82) by the way :)

Rainmaker52 commented 13 years ago

Simply removing the line invalidate_inodes(zsb->z_parent->z_sb); in the zfsvfs_teardown function, seems to cause zfs-0.6.0 to compile.

I seem to be able to do the basics (ls, create a file, mount the FS, umount it etc) (the fs layer seems to be working :D)

Could the reason for you seeing these errors be that I'm using GCC and you're using ICC?

behlendorf commented 13 years ago

Right, so invalidate_inodes() is no longer being exported in the 2.6.37 kernel, which basically means the upstream kernel developers decided that normal modules shouldn't be able to call this. I'll add a patch next week to either work around this, or see if they didn't add a new preferred API which gets us what we need.

In the meanwhile the only side effect of comment out that line will be that rollbacks will be broken. If you try to rollback a filesystem it will appear that certain files remain because they still exist in the Linux inode cache.

behlendorf commented 13 years ago

Closing issue, this is fixed in the laster spl/zfs master branches. They can now build with 2.6.32 - 2.6.38-rc4 kernels.