Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kernel 3.5-rc2 compile issue #784

Closed
colorprint opened this issue Jun 12, 2012 · 10 comments
Closed

Kernel 3.5-rc2 compile issue #784

colorprint opened this issue Jun 12, 2012 · 10 comments
Labels
Type: Building Indicates an issue related to building binaries
Milestone

Comments

@colorprint
Copy link

Can't compile ZFS with 3.5-rc2 kernel:

CC [M] /var/lib/dkms/zfs/0.6.0.64/build/module/zfs/../../module/zfs/zpl_export.o
/var/lib/dkms/zfs/0.6.0.64/build/module/zfs/../../module/zfs/zpl_export.c:120:2: warning: initialization from incompatible pointer type [enabled by default]
/var/lib/dkms/zfs/0.6.0.64/build/module/zfs/../../module/zfs/zpl_export.c:120:2: warning: (near initialization for ‘zpl_export_operations.encode_fh’) [enabled by default]
CC [M] /var/lib/dkms/zfs/0.6.0.64/build/module/zfs/../../module/zfs/zpl_file.o
CC [M] /var/lib/dkms/zfs/0.6.0.64/build/module/zfs/../../module/zfs/zpl_inode.o
/var/lib/dkms/zfs/0.6.0.64/build/module/zfs/../../module/zfs/zpl_inode.c:383:2: error: unknown field ‘truncate_range’ specified in initializer
/var/lib/dkms/zfs/0.6.0.64/build/module/zfs/../../module/zfs/zpl_inode.c:383:2: warning: initialization from incompatible pointer type [enabled by default]
/var/lib/dkms/zfs/0.6.0.64/build/module/zfs/../../module/zfs/zpl_inode.c:383:2: warning: (near initialization for ‘zpl_inode_operations.removexattr’) [enabled by default]

@colorprint
Copy link
Author

This is because of these changes in the kernel:
http://lists-archives.com/linux-kernel/27636469-mm-fs-remove-truncate_range.html

@colorprint
Copy link
Author

same with 3.5-rc3 kernel

@ryao
Copy link
Contributor

ryao commented Jun 22, 2012

torvalds/linux@b0b0382 caused that. ZFSOnLinux requires that autotools checks be written for API changes. I do not have time to write those right now, but here is an inline patch that you can apply locally:

diff --git a/module/zfs/zpl_export.c b/module/zfs/zpl_export.c
index f82ee30..5b55a6f 100644
--- a/module/zfs/zpl_export.c
+++ b/module/zfs/zpl_export.c
@@ -30,10 +30,9 @@


 static int
-zpl_encode_fh(struct dentry *dentry, __u32 *fh, int *max_len, int connectable)
+zpl_encode_fh(struct inode *ip, __u32 *fh, int *max_len, struct inode *parent)
 {
        fid_t *fid = (fid_t *)fh;
-       struct inode *ip = dentry->d_inode;
        int len_bytes, rc;

        len_bytes = *max_len * sizeof (__u32);}

@colorprint
Copy link
Author

After the patch applied now have similar problem in another file:

/var/lib/dkms/zfs/0.6.0.65/build/module/zfs/../../module/zfs/zpl_inode.c:383:2: error: unknown field ‘truncate_range’ specified in initializer

@colorprint
Copy link
Author

BTW, this error was in the start post too )

@ryao
Copy link
Contributor

ryao commented Jun 22, 2012

Sorry about that. truncate_range was removed in torvalds/linux@1193755. Delete line 383 in ./module/zfs/zpl_inode.c.

@colorprint
Copy link
Author

Well, I have removed this line and now have the error in the zpl_super.c:

/var/lib/dkms/zfs/0.6.0.65/build/module/zfs/../../module/zfs/zpl_inode.c:333:1: warning: ‘zpl_truncate_range’ defined but not used [-Wunused-function]
CC [M] /var/lib/dkms/zfs/0.6.0.65/build/module/zfs/../../module/zfs/zpl_super.o
/var/lib/dkms/zfs/0.6.0.65/build/module/zfs/../../module/zfs/zpl_super.c: In function ‘zpl_evict_inode’:
/var/lib/dkms/zfs/0.6.0.65/build/module/zfs/../../module/zfs/zpl_super.c:78:2: error: implicit declaration of function ‘end_writeback’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

@ryao
Copy link
Contributor

ryao commented Jun 22, 2012

torvalds/linux@90324cc caused that. Here is a revised patch that covers the 3 issues mentioned so far:

diff --git a/module/zfs/zpl_export.c b/module/zfs/zpl_export.c
index f82ee30..5b55a6f 100644
--- a/module/zfs/zpl_export.c
+++ b/module/zfs/zpl_export.c
@@ -30,10 +30,9 @@


 static int
-zpl_encode_fh(struct dentry *dentry, __u32 *fh, int *max_len, int connectable)
+zpl_encode_fh(struct inode *ip, __u32 *fh, int *max_len, struct inode *parent)
 {
        fid_t *fid = (fid_t *)fh;
-       struct inode *ip = dentry->d_inode;
        int len_bytes, rc;

        len_bytes = *max_len * sizeof (__u32);
diff --git a/module/zfs/zpl_inode.c b/module/zfs/zpl_inode.c
index 5b6692f..3636ee3 100644
--- a/module/zfs/zpl_inode.c
+++ b/module/zfs/zpl_inode.c
@@ -380,7 +380,6 @@ const struct inode_operations zpl_inode_operations = {
        .getxattr       = generic_getxattr,
        .removexattr    = generic_removexattr,
        .listxattr      = zpl_xattr_list,
-       .truncate_range = zpl_truncate_range,
 #ifdef HAVE_INODE_FALLOCATE
        .fallocate      = zpl_fallocate,
 #endif /* HAVE_INODE_FALLOCATE */
diff --git a/module/zfs/zpl_super.c b/module/zfs/zpl_super.c
index 98d0a03..902f412 100644
--- a/module/zfs/zpl_super.c
+++ b/module/zfs/zpl_super.c
@@ -75,7 +75,7 @@ static void
 zpl_evict_inode(struct inode *ip)
 {
        truncate_setsize(ip, 0);
-       end_writeback(ip);
+       clear_inode(ip);
        zfs_inactive(ip);
 }

Writing patches to make ZFS build against a single kernel version is relatively easy for me while writing the autotools tests needed for these changes to be merged is a bit more involved. I have other things that I need to do, so I am patching these build failures by eye rather than actually building it myself. The patches are correct, but the result is that we are iterating on this on github.

You might want to chat with me on freenode in the #zfsonlinux channel. It is faster than iterating back and forth on github.

@colorprint
Copy link
Author

Thank you so much, it works now

@ryao
Copy link
Contributor

ryao commented Jun 23, 2012

@colorprint That is great news.

As a note for future me, torvalds/linux@17cf28a removed truncate_range(). The file hole punching functionality is provided by fallocate(). cb2d190 added support for that to ZFSOnLinux.

ryao added a commit to ryao/zfs that referenced this issue Jul 12, 2012
torvalds/linux@b0b0382 changed
export_operations->encode_fn() to use struct inode * instead of struct
dentry *

torvalds/linux@dbd5768 renamed
end_writeback() to clear_inode()

torvalds/linux@17cf28a removed
inode_operations->truncate_range(). The file hole punching functionality
is provided by inode_operations->fallocate()

Closes openzfs#784

Signed-off-by: Richard Yao <[email protected]>
behlendorf pushed a commit to behlendorf/zfs that referenced this issue Jul 23, 2012
The export_operations member ->encode_fh() has been updated to
take both the child and parent inodes.  This interface used to
take the child dentry and a bool describing if the parent is needed.

NOTE: While updating this code I noticed that we do not currently
cleanly handle the case where we're passed a connectable parent.
This code should be audited to make sure we're doing the right thing.

Signed-off-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#784
behlendorf pushed a commit to behlendorf/zfs that referenced this issue Jul 23, 2012
The vmtruncate_range() support has been removed from the kernel in
favor of using the fallocate method in the file_operations table.

Signed-off-by: Richard Yao <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Issue openzfs#784
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Building Indicates an issue related to building binaries
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants