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

There was a error when building zfs #5101

Merged
merged 1 commit into from
Sep 17, 2016
Merged

Conversation

legend-hua
Copy link
Contributor

issues:
zfs build

./configure --with-spl=/home/liuhua/OpenZFS/spl-master913/spl-master/

make -s -j$(nproc)

randfree_file.c: In function ‘main’:
randfree_file.c:101: error: ‘FALLOC_FL_PUNCH_HOLE’ undeclared (first use in this function)
randfree_file.c:101: error: (Each undeclared identifier is reported only once
randfree_file.c:101: error: for each function it appears in.)
make[5]: *** [randfree_file.o] Error 1
make[4]: *** [all-recursive] Error 1
make[3]: *** [all-recursive] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2

The FALLOC_FL_PUNCH_HOLE flag was introduced in the 2.6.38 kernel. So we need add the "#if...#endif" when linux kernel is 2.6.33.20.

if (fallocate(fd, FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE,
start_off, off_len) < 0) {
perror("fallocate");
return (1);
}
#endif /* defined(FALLOC_FL_PUNCH_HOLE) && defined(FALLOC_FL_KEEP_SIZE) */
Copy link
Contributor

Choose a reason for hiding this comment

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

This does fix the build issue but it also silently breaks this utility for older kernels. Let's add an #else case to the conditional to print an error message along the lines of "FALLOC_FL_PUNCH_HOLE unsupported" and return (1); to indicate an error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for your advice

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have submitted the same code twice, but the CI has different failures log , why? The CI environment is unstable? Please help me, thank you @behlendorf

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, please just address the inline comments.

@legend-hua legend-hua force-pushed the EC branch 2 times, most recently from 202778f to cae428f Compare September 15, 2016 17:19
issues:
zfs build

randfree_file.c: In function ‘main’:
randfree_file.c:101: error: ‘FALLOC_FL_PUNCH_HOLE’ undeclared (first use in this function)

solution:
The FALLOC_FL_PUNCH_HOLE flag was introduced in the 2.6.38 kernel. So we need add the "#if #else #endif" for older kernel.
@behlendorf
Copy link
Contributor

Unfortunately, we do still have some occasional test failures in the CI environment. We're working to improve that but for the moment there are still problems. If you do get a failure I'd suggest looking at the open issues marked with the Test Suite label to determine if it's a known issue.

For example, your Ubuntu 14.04 failure was due to issue #4034, I've opened #5120 to disable the offending test case for now since it's a long standing issue which has suddenly before more frequent. It would be great if you could review the #5120 PR.

As for this patch, it's definitely not causing any of these failures so I'll get it merged.

@legend-hua
Copy link
Contributor Author

Thanks so much for your suggestion. I will continue to focus on this issue, and the test case. @behlendorf

@behlendorf behlendorf merged commit a34f7ab into openzfs:master Sep 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants