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

[overlay] add configurable mount options to overlay snapshotter #8676

Merged
merged 1 commit into from
Jun 13, 2023

Conversation

dmcgowan
Copy link
Member

Allows default mount options to be provided through configuration. This allows configurations to use options supported by the kernel without requiring an update to the overlay plugin.

Note: this still wouldn't be appropriate for the volatile option, an additional change would be necessary to strip the "volatile" option on temp mounts. Such as https://github.com/containerd/containerd/pull/8402/files#diff-5adff636c3210a8801cbc84d4431a5ee66e8bab1985a88fd59c6e895b604914c

Copy link
Member

@akhilerm akhilerm left a comment

Choose a reason for hiding this comment

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

Have a question on using append operation on the slice in WithMountOptions

// NOTE: Options are not applied to bind mounts.
func WithMountOptions(options []string) Opt {
return func(config *SnapshotterConfig) error {
config.mountOptions = options
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
config.mountOptions = options
config.mountOptions = append(config.mountOptions, options)

Is it better to use an append operation here?

Copy link
Member Author

Choose a reason for hiding this comment

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

You are right, updated

if err != nil {
logrus.WithError(err).Warnf("cannot detect whether \"userxattr\" option needs to be used, assuming to be %v", userxattr)

if !hasOption(config.mountOptions, "userxattr", false) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like you may silently enable userxattr even if a user didn't want it, I mean didn't specify it. Is it better to allow a user to choose and if option is specified we check whether kernel supports it, etc or to completely rely on a user's choice without extra checks?

Copy link
Member

@AkihiroSuda AkihiroSuda Jun 12, 2023

Choose a reason for hiding this comment

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

Is it better to allow a user to choose and if option is specified we check whether kernel supports it, etc or to completely rely on a user's choice without extra checks?

No, that's a breaking change.

Copy link
Contributor

Choose a reason for hiding this comment

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

No, that's a breaking change.

IIUC, this will be a backward compatibility issue. Anyway, in this case there's no way to "unset" userxattr option, even though by default it is "on" this PR adds a possibility to "unset" options.

Another case I see may appear with conflicting options userxattr|metacopy|redirect_{dir,follow,etc.}, even though for time being this may be omitted but later this will be the case, because you will need to break this behavior, otherwise it looks like there's no way to support metacopy|redirect_dir at least as it is now.

Copy link
Member

Choose a reason for hiding this comment

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

In the user namespace it is essential to specify userxattr.
torvalds/linux@2d2f2d7

Outside the user namespace it shouldn't be specified (and actually not specified in this PR).

Copy link
Member Author

Choose a reason for hiding this comment

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

If options conflict with userxattr, a check could be added for it. I would suggest that be done in a follow up though since this change is scoped to adding the options and not any behavior change or new functionality.

Copy link
Contributor

@IlyaHanov IlyaHanov Jun 12, 2023

Choose a reason for hiding this comment

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

Outside the user namespace it shouldn't be specified (and actually not specified in this PR).

As I can see, this PR opens the possibility to do that, e.g. mount_options=userxattr,... :D

If options conflict with userxattr, a check could be added for it. I would suggest that be done in a follow up though since this change is scoped to adding the options and not any behavior change or new functionality

Ok, the last moment from me -- what about to update the documentation (not sure whether it has anything about which options containerd supports and which doesn't) to prevent a user to specify any conflicting options.

Also, looks like it is reasonable to at least warn a user that even though this option didn't specify it is enabled.

Copy link
Member Author

Choose a reason for hiding this comment

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

The documentation can be updated in a later PR. We don't always immediately document new features like this, especially as you pointed out, there may be edge cases to figure out that should be pointed out to users.

Allows default mount options to be provided through configuration.

Signed-off-by: Derek McGowan <derek@mcg.dev>
@kzys kzys merged commit 0f6a70d into containerd:main Jun 13, 2023
@fuweid fuweid added the cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch label Aug 24, 2023
@estesp estesp added the cherry-picked/1.7.x PR commits are cherry-picked into release/1.7 branch label Oct 24, 2023
@dmcgowan dmcgowan deleted the overlay-options branch April 20, 2024 00:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch cherry-picked/1.7.x PR commits are cherry-picked into release/1.7 branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants