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

Linux 4.14 compat: vfs_read/write #659

Closed
wants to merge 1 commit into from

Conversation

rfehren
Copy link

@rfehren rfehren commented Oct 9, 2017

Commit torvalds/linux@bd8df82b
- Unexport vfs_read and vfs_write

Patch received basic run-time testing applied to the spl-0.7-release branch and built against 4.14-rc3.

Copy link
Contributor

@behlendorf behlendorf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for noticing this and providing a patch. I've added some review comments inline. When you're refreshing this can you please also do the following.

  • Rebase on SPL master.
  • Open an additional dummy PR against ZFS with the line Requires-spl: refs/pull/659/head in the commit message. This way the SPL commit will be run through our automated testing against a variety of kernels. PR Test SPL PR - style fixes zfs#6726 is a good example of this.
  • Add your signed-off-by to the commit git commit -s.

rc = vfs_read(fp, addr, len, &offset);
#else
rc = kernel_read(fp, addr, len, &offset);
#endif /* HAVE_VFS_WRITE */
Copy link
Contributor

@behlendorf behlendorf Oct 9, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like kernel_write() was exported in v3.8 torvalds/linux@7bb307e and kernel_read() in 3.9 torvalds/linux@3dc20cb. This is arguably when we should have moved over to these new interfaces.

What we need to do to handle this is to add a configure check for both kernel_read and kernel_write and a compatibility wrapper for each of these called spl_kernel_read() and spl_kernel_write() for consistency. The wrappers should prefer the kernel_* interfaces if they're determined to be available. And since these functions are only called from spl-vnode.c they can be added there and declared static.

There are a couple things to be careful of when implementing the wrappers.

  • The arguments for the functions do not appear in the same order.
  • vfs_read/write functions don't handle the set_fs() bit but the kernel_read/write functions do. This logic will need to be pulled in to the wrapper for only the vfs_read/write case and out of vn_rdwr.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, I won't have the time to work further on this issue. Concerning your comments: I would actually leave it the way it is. All previous ZFS versions compiled against kernels < 4.14 have been using vfs_read/write and were tested against this. Why risk catching a regression with such kernels due to a possibly buggy early implemenation of kernel_read/write? I don't see a benefit, only potential problems when using kernel_read/write with kernels < 4.14.
I signed off the commit rebased and pushed.

    Commit torvalds/linux@bd8df82b
    - Unexport vfs_read and vfs_write

Signed-off-by: Roland Fehrenbacher <rf@q-leap.de>
@bmaxa
Copy link

bmaxa commented Nov 1, 2017

I have problem with this patch, cannot mount files on older kernels. Drives mount ok.
I also have this errors in dmesg on kernel 4.14 when importing pools,
noop error is because I use blk-mq and there noop is called none.
143.026192] attempt to access beyond end of device
[ 143.026194] unknown-block(8,0): rw=0, want=468862135, limit=468862128
[ 143.026195] Buffer I/O error on dev sda1, logical block 58607758, async page read
[ 144.193110] attempt to access beyond end of device
[ 144.193115] unknown-block(8,16): rw=0, want=3907029175, limit=3907029168
[ 144.193119] attempt to access beyond end of device
[ 144.193121] unknown-block(8,16): rw=0, want=3907029175, limit=3907029168
[ 144.193123] Buffer I/O error on dev sdb1, logical block 488378638, async page read
[ 145.009731] ZFS: Unable to set "noop" scheduler for /dev/disk/by-id/ata-ST2000VN000-1H3164_W1H2DSKA-part1 (sdc): 256
[ 145.256794] ZFS: Unable to set "noop" scheduler for /dev/disk/by-id/ata-ST2000VN000-1H3164_W1H2DSKA-part1 (sdc): 256

@behlendorf
Copy link
Contributor

Replaced by #667.

@behlendorf behlendorf closed this Nov 14, 2017
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.

None yet

3 participants