Skip to content
This repository was archived by the owner on Feb 26, 2020. It is now read-only.

Linux 4.14 compat: vfs_read & vfs_write - #667

Merged
behlendorf merged 1 commit into
openzfs:masterfrom
behlendorf:linux-4.14-compat
Nov 16, 2017
Merged

behlendorf merged 1 commit into
openzfs:masterfrom
behlendorf:linux-4.14-compat

Conversation

@behlendorf

Copy link
Copy Markdown
Contributor

Slightly modified version of #666 for 4.14 kernels.

  • Strict prototype checking was moved to configure removing the need for LINUX_VERSION_CODE. This is desirable because ensures the code always uses the correct interface even when patches from the upstream kernel are cherry picked for older kernels.

  • spl_kernel_write/spl_kernel_read wrapper functions moved to file_compat.h.

  • Compatibility code for vfs_read was left in place even though all supported kernel versions should provide kernel_read. Just in case.

@pritambaral

Copy link
Copy Markdown

This looks much better than #666. :)

@behlendorf

Copy link
Copy Markdown
Contributor Author

@pritambaral unfortunately it was also broken, which is why all the send/recv tests failed. I've refreshed the patch to drop the old versions of kernel_read/kernel_write. We can't use them because we depend on the value referenced by the pos pointer being updated in order to update the file position. Since the old versions pass the value directly they cannot be used. That's alright, allowing only two interfaces here still covers all cases and is simpler and safer.

@pritambaral

pritambaral commented Nov 15, 2017 •

Copy link
Copy Markdown

I think this is fine. I supported the old kernel_read/kernel_write APIs only for the sake of any future backports to those APIs; chances of which are pretty low anyway. And if those old APIs do receive any backported fixes, corresponding changes can be made in spl too.

The kernel_read & kernel_write functions have always wrapped the
vfs_read & vfs_write functions respectively.  However, they could
not be used by vn_rdwr() since the offset wasn't passed as a
pointer.  This prevented us from being able to properly update
the file offset.

Linux 4.14 unexported vfs_read & vfs_write but also changed the
signature of kernel_read & kernel_write to provide the needed
functionality.  Use these updated functions when available.

Reviewed-by: Pritam Baral <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
@behlendorf
behlendorf merged commit ed19bcc into openzfs:master Nov 16, 2017
tonyhutter pushed a commit to tonyhutter/spl that referenced this pull request Nov 21, 2017
The kernel_read & kernel_write functions have always wrapped the
vfs_read & vfs_write functions respectively.  However, they could
not be used by vn_rdwr() since the offset wasn't passed as a
pointer.  This prevented us from being able to properly update
the file offset.

Linux 4.14 unexported vfs_read & vfs_write but also changed the
signature of kernel_read & kernel_write to provide the needed
functionality.  Use these updated functions when available.

Reviewed-by: Pritam Baral <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes openzfs#656 
Closes openzfs#667
@akatrevorjay

akatrevorjay commented Dec 8, 2017 •

Copy link
Copy Markdown

This did not detect properly on my system, fyi (4.14.x), I didn't even look into why to be honest, I just hard coded the options in zfs_config.in

@behlendorf

behlendorf commented Dec 8, 2017 •

Copy link
Copy Markdown
Contributor Author

@akatrevorjay can you provide the exact kernel version and distribution where this didn't work.

@akatrevorjay

akatrevorjay commented Dec 11, 2017 via email

Copy link
Copy Markdown

@tonyhutter

Copy link
Copy Markdown
Contributor

@akatrevorjay zfs master builds fine for me on ubuntu 17.10 with the 4.14.5 kernel from http://kernel.ubuntu.com/~kernel-ppa/mainline/v4.14.5/.

...
  LD [M]  /home/hutter/master/zfs/module/zfs/zfs.o
  Building modules, stage 2.
  MODPOST 6 modules
  CC      /home/hutter/master/zfs/module/avl/zavl.mod.o
  CC      /home/hutter/master/zfs/module/icp/icp.mod.o
  CC      /home/hutter/master/zfs/module/nvpair/znvpair.mod.o
  CC      /home/hutter/master/zfs/module/unicode/zunicode.mod.o
  CC      /home/hutter/master/zfs/module/zcommon/zcommon.mod.o
  CC      /home/hutter/master/zfs/module/zfs/zfs.mod.o
  LD [M]  /home/hutter/master/zfs/module/nvpair/znvpair.ko
  LD [M]  /home/hutter/master/zfs/module/zcommon/zcommon.ko
  LD [M]  /home/hutter/master/zfs/module/avl/zavl.ko
  LD [M]  /home/hutter/master/zfs/module/unicode/zunicode.ko
  LD [M]  /home/hutter/master/zfs/module/icp/icp.ko
  LD [M]  /home/hutter/master/zfs/module/zfs/zfs.ko
make[3]: Leaving directory '/usr/src/linux-headers-4.14.5-041405-generic'
make[2]: Leaving directory '/home/hutter/master/zfs/module'
make[2]: Entering directory '/home/hutter/master/zfs'
make[2]: Nothing to be done for 'all-am'.
make[2]: Leaving directory '/home/hutter/master/zfs'
make[1]: Leaving directory '/home/hutter/master/zfs'
hutter@ubuntu17:~/master/zfs$ uname -a
Linux ubuntu17 4.14.5-041405-generic #201712101332 SMP Sun Dec 10 13:33:10 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

Are you using the latest zfs and spl? Can you list your build commands and build errors?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants