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

Change size limitation for all file paths and node_id #464

Merged
merged 1 commit into from
Feb 4, 2021

Conversation

Jiawei0227
Copy link
Contributor

@Jiawei0227 Jiawei0227 commented Nov 11, 2020

Size limitation default for CSI spec is 128 bytes.
This has been brought up several times in different issues[1][2] that we should increase the limitation.

I think there are two types of length now need to increase:

  1. node_id
  2. file_paths including(target_path, volume_path, staging_target_path)

In this PR, suggest to increase node_id length limitation to 192 bytes.
For all other paths related field, remove the limitation of 128 and instead put a minimal support size of 128 bytes

[1] #350
[2] kubernetes-sigs/gcp-compute-persistent-disk-csi-driver#581

@saad-ali
Copy link
Member

Discussed this at community meeting. See notes here.

@Jiawei0227
Copy link
Contributor Author

/assign @saad-ali
/cc @msau42 @gnufied

Copy link
Member

@saad-ali saad-ali left a comment

Choose a reason for hiding this comment

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

@jdef @jieyu PTAL

Also let's get input from @gnufied @jsafrane - Per Hemant, even existing 128 length limit for paths may be a problem for systemd.

spec.md Outdated Show resolved Hide resolved
spec.md Outdated Show resolved Hide resolved
@jdef
Copy link
Member

jdef commented Jan 8, 2021 via email

@saad-ali
Copy link
Member

saad-ali commented Jan 8, 2021

Why is the new limit for node id 253 instead of 256? Something k8s specific?

Yep, k8s object name length limit is 253 and these id's end up being used there.

csi.proto Outdated
// This field overrides the general CSI size limit.
// The size of this field SHALL NOT exceed 256 bytes. The general
// CSI size limit, 128 byte, is RECOMMENDED for best backwards
// compatibility.
Copy link
Contributor

@gnufied gnufied Jan 8, 2021

Choose a reason for hiding this comment

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

I was checking the systemd issue again and 256 indeed is too big to be a unit name for mount point to be managed by systemd. More details are here - https://github.com/systemd/systemd/pull/15911/files#diff-cba2cdf3ac7ac3975d69ed999252a138fed94763e46312c7e48500744eb8028aR452 . The issue itself is discussed in more detail - systemd/systemd#14294

The underlying reasoning is - on Linux FILENAME_MAX is 256 chars and hence you can't make a file whose name is bigger than 256 character. Now each mount point typically when managed via systemd gets converted to a unit name. This conversion happens on whole path and hence if it is bigger than 256 chars, systemd fails to manage it.

It should also be noted that, there is another variable called PATH_MAX which defines the maximum length of whole path (i.e not just the last component) and according to https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation the value is 260 characters on windows and hence setting this to 256 char will be pushing it awfully close to the upper limit.

So I think that 256 char might actually be too close to the upper limit of maximum path lengths and we might have to reduce the length. I don't know what good default will be but something smaller I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm, what about 192? Seems like a magic number to use

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 am putting 192 as the reduced length for both node_id and path. So it could be less error-prone.

We can talk more in the next CSI meeting to confirm this tho.

@Jiawei0227
Copy link
Contributor Author

Changed as per discussion in the CSI community meeting

Notes:

256 can be a little too close. So to make it less error-prone, suggest change to 192 for both node_id and path
Systemd has a 256 limit
Windows has a 260 limit
Includes prefix “/var/lib/kubelet/…” some distros use different dir.
Nothing at gRPC level enforces this, SP should enforce it. Some may do it, some may not. Change to new limit will take time.
Some CSI drivers may enforce the path limit on the driver side, so CO MUST gracefully handle that and surface a good error.
Rex Ray library enforces path limit -- but RexRay lib will be deprecated
Increase to 192 gives 60ish characters for prefix, will that be enough?
e.g. /var/lib/kubelet/pods/{uid}/volumes/{pluginName}...{volumeName}
If someone makes every field max length it will overflow.
Why enforce any limit at all?
OS have limits? Could put a floor instead of max
E.g. for file paths, SP MUST allow at least 128 bytes, and SHOULD allow max of what ever OS allows.
If no limit defined, SP can make a really long path, and it may not run on different OSes (e.g. Windows 260 char, Systemd 256 char, etc.).
Can put a limit on all the fields that go in in to the path.
What if SP only supports minimum? They are hurting themselves, by lowering compatibility.
What if plugin is Legally max on all fields (e.g. plugin name, etc.)
CSI limits plugin name to 63 characters or less
Decision
For file paths, change to a “min” required and OS limit as recommended.
Ensure on the k8s side it gracefully handles that and surface a good error

spec.md Outdated Show resolved Hide resolved
spec.md Show resolved Hide resolved
- Not put limit on paths length limiation. But add
  a minial support length floor.
- Change node_id length limitation to 192 bytes
Copy link
Member

@saad-ali saad-ali left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

PTAL @gnufied @jdef @jsafrane @jieyu @julian-hj

@gnufied
Copy link
Contributor

gnufied commented Jan 26, 2021

lgtm too!

@Jiawei0227
Copy link
Contributor Author

@jdef Hey James, would you mind take another look at this?

@ddebroy
Copy link
Contributor

ddebroy commented Feb 4, 2021

lgtm

@saad-ali
Copy link
Member

saad-ali commented Feb 4, 2021

Merging

@saad-ali saad-ali merged commit 396c333 into container-storage-interface:master Feb 4, 2021
@jdef
Copy link
Member

jdef commented Feb 12, 2021

LGTM, thanks all!

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.

5 participants