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

PWX-40172 (master): makes chattr ignore 'inappropriate ioctl' errors #2502

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Pure-AdamuKaapan
Copy link
Contributor

What this PR does / why we need it:
In some OSes like SLE Micro, the /var directory is mounted using an overlay filesystem. Something in this setup does not support chattr. In this case, we should just ignore inappropriate ioctl for device errors as there is nothing we can do.

Which issue(s) this PR fixes (optional)
PWX-40172

Testing Notes

  • Confirmed PX installs on a Harvester system
  • Added UTs that make an NTFS loopback device (as NTFS does not support chattr either), mounts it, and confirms our chattr code still succeeds.


stderrStr := stderr.String()
if isInappropriateIoctl(stderrStr) { // Returned in case of filesystem that does not support chattr
return nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Uh.. this override will unconditionally turn off the inappropriate ioctl for device (also invalid argument while setting flags) errors on chattr for ALL PLATFORMS.

I wonder if we could avoid it?

Some suggestions that might work:

  1. have AddImmutable() return the inappropriate ioctl for device error -- and let the caller handle the "error ignoring", or
  2. extend the AddImmutable() by adding AddImmutable(..., errorsToIgnore []error) and have the caller populate the "errors to ignore" list, or
  3. have the chattr command "overrideable" -- so that the caller may change/override the OpenStorage's chattr command with own implementation, before calling AddImmutable() [or, mounting volume]

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm.. I see that your comment above said "// Returned in case of filesystem that does not support chattr"

  • so, I suppose you are making an argument that "chattr aways returns the ENOTTY when filesystem does not support the chattr'ing"
  • my concern was that we'll also be masking the "legal errors" -- (maybe use a "wrong device" like perhaps chattr /dev/stderr) -- which is why I'd look for means to reduce the "blast radius" of this change, and limit it only to the SLE-Micro Linux platform

Let's see of others from the team would have any comments / feedback

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was my assumption (it always returns one of those two errors I linked), but I do not know that for sure and I agree that it would mask "legal" errors.

The "override" option seems the most feasible, especially because when we run that platform detection code we can have it also set perhaps IgnoreChattrIOCTLErrors = true or something. Then the caller has the responsibility of knowing what cases that it matters in.

@zoxpx zoxpx requested a review from a team November 26, 2024 03:54
Copy link

This PR is stale because it has been in review for 3 days with no activity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants