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

4.16 kernel: atomic_dec_and_test() changed #7179

Closed
tonyhutter opened this issue Feb 16, 2018 · 3 comments · Fixed by #7211
Closed

4.16 kernel: atomic_dec_and_test() changed #7179

tonyhutter opened this issue Feb 16, 2018 · 3 comments · Fixed by #7211
Assignees

Comments

@tonyhutter
Copy link
Contributor

I hit these errors building against the 4.16 nightly kernel packages (http://kernel.ubuntu.com/~kernel-ppa/mainline/daily/current/):

  CC [M]  /home/hutter/zfs/module/zcommon/zpool_prop.o
  CC [M]  /home/hutter/zfs/module/lua/lfunc.o
In file included from /home/hutter/zfs/include/sys/zpl.h:37:0,
                 from /home/hutter/zfs/module/zfs/arc.c:298:
/home/hutter/zfs/include/linux/vfs_compat.h: In function ‘zpl_posix_acl_release’:
/home/hutter/zfs/include/linux/vfs_compat.h:292:26: error: passing argument 1 of ‘atomic_dec_and_test’ from incompatible pointer type [-Werror=incompatible-pointer-types]
  if (atomic_dec_and_test(&acl->a_refcount))
                          ^
In file included from ./arch/x86/include/asm/msr.h:67:0,
                 from ./arch/x86/include/asm/processor.h:21,
                 from ./arch/x86/include/asm/cpufeature.h:5,
                 from ./arch/x86/include/asm/thread_info.h:53,
                 from ./include/linux/thread_info.h:38,
                 from ./arch/x86/include/asm/preempt.h:7,
                 from ./include/linux/preempt.h:81,
                 from ./include/linux/spinlock.h:51,
                 from ./include/linux/seqlock.h:36,
                 from ./include/linux/time.h:6,
                 from ./include/linux/stat.h:19,
                 from ./include/linux/module.h:10,
                 from /home/hutter/zfs/../spl/include/sys/sysmacros.h:28,
                 from /home/hutter/zfs/../spl/include/sys/types.h:29,
                 from /home/hutter/zfs/include/sys/avl.h:42,
                 from /home/hutter/zfs/include/sys/spa.h:35,
                 from /home/hutter/zfs/module/zfs/arc.c:278:
./arch/x86/include/asm/atomic.h:116:29: note: expected ‘atomic_t * {aka struct <anonymous> *}’ but argument is of type ‘refcount_t * {aka struct refcount_struct *}’
 static __always_inline bool atomic_dec_and_test(atomic_t *v)
                             ^~~~~~~~~~~~~~~~~~~
  CC [M]  /home/hutter/zfs/module/icp/core/kcf_prov_tabs.o
  CC [M]  /home/hutter/zfs/module/zcommon/zprop_common.o

System information

Type Version/Name
Distribution Name Ubuntu
Distribution Version 17.10
Linux Kernel 4.16.0-999-generic
Architecture x86-64
ZFS Version master e921f65
SPL Version master 48ef8ba
@tonyhutter tonyhutter self-assigned this Feb 16, 2018
@tonyhutter
Copy link
Contributor Author

This seems to fix it:

diff --git a/include/linux/vfs_compat.h b/include/linux/vfs_compat.h
index 7fcf3c055..f20905b34 100644
--- a/include/linux/vfs_compat.h
+++ b/include/linux/vfs_compat.h
@@ -289,7 +289,7 @@ zpl_posix_acl_release(struct posix_acl *acl)
        if ((acl == NULL) || (acl == ACL_NOT_CACHED))
                return;
 
-       if (atomic_dec_and_test(&acl->a_refcount))
+       if (refcount_dec_and_test(&acl->a_refcount))
                zpl_posix_acl_release_impl(acl);
 }
 #endif /* HAVE_POSIX_ACL_RELEASE */

https://www.redhat.com/archives/linux-audit/2017-July/msg00060.html

I'll put together a PR

@behlendorf
Copy link
Contributor

behlendorf commented Feb 20, 2018

It looks like we're going to need a little more compatibility code for this.

@tonyhutter
Copy link
Contributor Author

@behlendorf yea, I'll do the normal autoconf tests for it.

tonyhutter added a commit to tonyhutter/zfs that referenced this issue Feb 22, 2018
Use refcount_dec_and_test() on 4.16+ kernels, atomic_dec_and_test()
on older kernels.  https://lwn.net/Articles/714974/

Signed-off-by: Tony Hutter <[email protected]>
Closes: openzfs#7179
behlendorf pushed a commit that referenced this issue Feb 22, 2018
Use refcount_dec_and_test() on 4.16+ kernels, atomic_dec_and_test()
on older kernels.  https://lwn.net/Articles/714974/

Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes: #7179 
Closes: #7211
tonyhutter added a commit to tonyhutter/zfs that referenced this issue Mar 7, 2018
Use refcount_dec_and_test() on 4.16+ kernels, atomic_dec_and_test()
on older kernels.  https://lwn.net/Articles/714974/

Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes: openzfs#7179 
Closes: openzfs#7211
tonyhutter pushed a commit to tonyhutter/zfs that referenced this issue Mar 7, 2018
This is a squashed patchset for zfs-0.7.7.  The individual commits are
in the tonyhutter:zfs-0.7.7-hutter branch.  I squashed the commits so
that buildbot wouldn't have to run against each one, and because
github/builbot seem to have a maximum limit of 30 commits they can
test from a PR.

- Linux 4.16 compat: get_disk_and_module() openzfs#7264
- Change checksum & IO delay ratelimit values openzfs#7252
- Increment zil_itx_needcopy_bytes properly openzfs#6988  openzfs#7176
- Fix some typos openzfs#7237
- Fix zpool(8) list example to match actual format openzfs#7244
- Add SMART self-test results to zpool status -c openzfs#7178
- Add scrub after resilver zed script openzfs#4662  openzfs#7086
- Fix free memory calculation on v3.14+ openzfs#7170
- Report duration and error in mmp_history entries openzfs#7190
- Do not initiate MMP writes while pool is suspended openzfs#7182
- Linux 4.16 compat: use correct *_dec_and_test() openzfs#7179  openzfs#7211
- Allow modprobe to fail when called within systemd openzfs#7174
- Add SMART attributes for SSD and NVMe openzfs#7183  openzfs#7193
- Correct count_uberblocks in mmp.kshlib openzfs#7191
- Fix config issues: frame size and headers openzfs#7169
- Clarify zinject(8) explanation of -e openzfs#7172
- OpenZFS 8857 - zio_remove_child() panic due to already destroyed
  parent zio openzfs#7168
- 'zfs receive' fails with "dataset is busy" openzfs#7129  openzfs#7154
- contrib/initramfs: add missing conf.d/zfs openzfs#7158
- mmp should use a fixed tag for spa_config locks openzfs#6530  openzfs#7155
- Handle zap_add() failures in mixed case mode openzfs#7011 openzfs#7054
- Fix zdb -ed on objset for exported pool openzfs#7099 openzfs#6464
- Fix zdb -E segfault openzfs#7099
- Fix zdb -R decompression openzfs#7099  openzfs#4984
- Fix racy assignment of zcb.zcb_haderrors openzfs#7099
- Fix zle_decompress out of bound access openzfs#7099
- Fix zdb -c traverse stop on damaged objset root openzfs#7099
- Linux 4.11 compat: avoid refcount_t name conflict openzfs#7148
- Linux 4.16 compat: inode_set_iversion() openzfs#7148
- OpenZFS 8966 - Source file zfs_acl.c, function zfs_aclset_common
  contains a use after end of the lifetime of a local variable openzfs#7141
- Remove deprecated zfs_arc_p_aggressive_disable openzfs#7135
- Fix default libdir for Debian/Ubuntu openzfs#7083  openzfs#7101
- Bug fix in qat_compress.c for vmalloc addr check openzfs#7125
- Fix systemd_ RPM macros usage on Debian-based distributions openzfs#7074
  openzfs#7100
- Emit an error message before MMP suspends pool openzfs#7048
- ZTS: Fix create-o_ashift test case openzfs#6924  openzfs#6977
- Fix --with-systemd on Debian-based distributions (openzfs#6963) openzfs#6591  openzfs#6963
- Remove vn_rename and vn_remove dependency openzfs/spl#648 openzfs#6753
- Add support for "--enable-code-coverage" option openzfs#6670
- Make "-fno-inline" compile option more accessible openzfs#6605
- Add configure option to enable gcov analysis openzfs#6642
- Implement --enable-debuginfo to force debuginfo openzfs#2734
- Make --enable-debug fail when given bogus args openzfs#2734

Signed-off-by: Tony Hutter <[email protected]>
Requires-spl: refs/pull/690/head
tonyhutter added a commit to tonyhutter/zfs that referenced this issue Mar 12, 2018
Use refcount_dec_and_test() on 4.16+ kernels, atomic_dec_and_test()
on older kernels.  https://lwn.net/Articles/714974/

Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes: openzfs#7179 
Closes: openzfs#7211
tonyhutter added a commit to tonyhutter/zfs that referenced this issue Mar 13, 2018
Use refcount_dec_and_test() on 4.16+ kernels, atomic_dec_and_test()
on older kernels.  https://lwn.net/Articles/714974/

Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes: openzfs#7179 
Closes: openzfs#7211
tonyhutter added a commit that referenced this issue Mar 19, 2018
Use refcount_dec_and_test() on 4.16+ kernels, atomic_dec_and_test()
on older kernels.  https://lwn.net/Articles/714974/

Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes: #7179
Closes: #7211
teknoman117 pushed a commit to teknoman117/zfs that referenced this issue Jun 7, 2018
Use refcount_dec_and_test() on 4.16+ kernels, atomic_dec_and_test()
on older kernels.  https://lwn.net/Articles/714974/

Reviewed-by: Giuseppe Di Natale <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Tony Hutter <[email protected]>
Closes: openzfs#7179 
Closes: openzfs#7211
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 a pull request may close this issue.

2 participants