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

libspl's getextmntent() fd leak on Linux, libzfs's obsession with the mtab #11868

Closed
wants to merge 3 commits into from

Conversation

nabijaczleweli
Copy link
Contributor

@nabijaczleweli nabijaczleweli commented Apr 8, 2021

Motivation and Context

Well, one's a leak, and the other's Weird?

Description

See individual commit messages.

This conflicts with #11866 and both will need a rebase if the other is merged.

How Has This Been Tested?

I ran zfs mount and it closed /proc/self/mounts and zfs list and it didn't even touch it.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Performance enhancement (non-breaking change which improves efficiency)
  • Code cleanup (non-breaking change which makes code smaller or more readable)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Library ABI change (libzfs, libzfs_core, libnvpair, libuutil and libzfsbootenv) – libzfs but only a private opaque member; also technically changes the ABI of libspl too to no longer leak the FILE*s, but, y'know
  • Documentation (a change to man pages or other documentation)

Checklist:

  • My code follows the OpenZFS code style requirements.
  • I have updated the documentation accordingly.
  • I have read the contributing document.
  • I have added tests to cover my changes. – none apply
  • I have run the ZFS Test Suite with this change applied. – CI take my hand
  • All commit messages are properly formatted and contain Signed-off-by.

@nabijaczleweli nabijaczleweli changed the title libspl's getextmntent() fd leak on Linux, libzfs obsession with the mtab libspl's getextmntent() fd leak on Linux, libzfs's obsession with the mtab Apr 8, 2021
@nabijaczleweli
Copy link
Contributor Author

checkstyle CI failed again, which is fair, that is UB, but I don't get why nothing else triggers this

@nabijaczleweli
Copy link
Contributor Author

Rebased

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.

I'm not sure what's going on with the lint warning either. That's quite strange, but something which will have to be sorted out.

include/libzfs_impl.h Outdated Show resolved Hide resolved
behlendorf pushed a commit that referenced this pull request Apr 12, 2021
Update the test images link to reference the openzfs github repository.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Issue #11868
@behlendorf
Copy link
Contributor

.gitmodules: link to openzfs github user

I've manually cherry picked this unrelated change in to master so you can drop it from this PR.

@nabijaczleweli
Copy link
Contributor Author

Updated to globally inline fopen()/fclose().

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
@nabijaczleweli
Copy link
Contributor Author

nabijaczleweli commented Apr 12, 2021

I make storeabid and make checkabi passes on my machine now, but CI has a problem with libzutil.h (which last changed in june of last year) for some reason?

@behlendorf
Copy link
Contributor

but CI has a problem with libzutil.h

It'd odd this results in an error even after you updated the libzfs.abi file. The ABI change itself is caused by the removal of libzfs_mnttab from the libzfs_handle. It order to avoid the otherwise unnecessary ABI change it might be prudent simply rename .libzfs_mnttab something like .libzfs_pad1; /* previously libzfs_mnttab */.

@nabijaczleweli
Copy link
Contributor Author

nabijaczleweli commented Apr 13, 2021

I mean, there is no ABI change, really, since all libzfs handles are opaque pointers (alternatively, if you consider that (FILE*)((char*)libzfs_init() + 8) is a valid use of libzfs, then your ABI is already epically owned if you make it padding, since it's all zero now, so freopen()s on it already segfault (musl) or return NULL (glibc), where they'd previously succeed); I'll try regenerating under fresher abigail, maybe.

@nabijaczleweli
Copy link
Contributor Author

Regenerated ABI on sid abigail and it's even more broken, which, lol

All users did a freopen() on it. Even some non-users did!
This is point-less ‒ just open the mtab when needed

If I understand Solaris' getextmntent(3C) correctly, the non-user
freopen()s are very likely an odd, twisted vestigial tail of that ‒
but it's got a completely different calling convention and caching
semantics than any platform we support

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
@nabijaczleweli
Copy link
Contributor Author

nabijaczleweli commented Apr 13, 2021

Did a full clean/regen/rebuild cycle and now the ABI is Okay apparently, abigail never ceases to amaze.

Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
@behlendorf behlendorf added Status: Accepted Ready to integrate (reviewed, tested) and removed Status: Code Review Needed Ready for review and testing labels Apr 13, 2021
behlendorf pushed a commit that referenced this pull request Apr 13, 2021
All users did a freopen() on it. Even some non-users did!
This is point-less ‒ just open the mtab when needed

If I understand Solaris' getextmntent(3C) correctly, the non-user
freopen()s are very likely an odd, twisted vestigial tail of that ‒
but it's got a completely different calling convention and caching
semantics than any platform we support

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11868
behlendorf pushed a commit that referenced this pull request Apr 13, 2021
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11868
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Apr 14, 2021
Update the test images link to reference the openzfs github repository.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Issue openzfs#11868
behlendorf pushed a commit to behlendorf/zfs that referenced this pull request Apr 14, 2021
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes openzfs#11868
mcmilk pushed a commit to mcmilk/zfs that referenced this pull request Apr 15, 2021
Update the test images link to reference the openzfs github repository.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Issue openzfs#11868
mcmilk pushed a commit to mcmilk/zfs that referenced this pull request Apr 15, 2021
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes openzfs#11868
mcmilk pushed a commit to mcmilk/zfs that referenced this pull request Apr 15, 2021
All users did a freopen() on it. Even some non-users did!
This is point-less ‒ just open the mtab when needed

If I understand Solaris' getextmntent(3C) correctly, the non-user
freopen()s are very likely an odd, twisted vestigial tail of that ‒
but it's got a completely different calling convention and caching
semantics than any platform we support

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes openzfs#11868
mcmilk pushed a commit to mcmilk/zfs that referenced this pull request Apr 15, 2021
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes openzfs#11868
ghost pushed a commit to truenas/zfs that referenced this pull request May 6, 2021
Update the test images link to reference the openzfs github repository.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Issue openzfs#11868
ghost pushed a commit to truenas/zfs that referenced this pull request May 6, 2021
Update the test images link to reference the openzfs github repository.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Issue openzfs#11868
ghost pushed a commit to truenas/zfs that referenced this pull request May 6, 2021
Update the test images link to reference the openzfs github repository.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Issue openzfs#11868
ghost pushed a commit to truenas/zfs that referenced this pull request May 7, 2021
Update the test images link to reference the openzfs github repository.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Issue openzfs#11868
sempervictus pushed a commit to sempervictus/zfs that referenced this pull request May 31, 2021
Update the test images link to reference the openzfs github repository.

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Issue openzfs#11868
sempervictus pushed a commit to sempervictus/zfs that referenced this pull request May 31, 2021
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes openzfs#11868
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Accepted Ready to integrate (reviewed, tested)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants