Skip to content

reef: mds: prevent clients from exceeding the xattrs key/value limits - #53339

Closed
trociny wants to merge 5 commits into
ceph:reeffrom
trociny:wip-59405-reef
Closed

trociny wants to merge 5 commits into
ceph:reeffrom
trociny:wip-59405-reef

Conversation

@trociny

@trociny trociny commented Sep 8, 2023

Copy link
Copy Markdown
Contributor

Luís Henriques added 5 commits September 8, 2023 18:59
This new configuration option will allow to define the maximum size for a
filesystem xattrs blob.  This is a filesystem-wide knob that will replace
the per-MDS mds_max_xattr_pairs_size option.

Note:

The kernel client patch to handle this new configuration was merged before
the corresponding ceph-side pull-request.  This was unfortunate because in
the meantime PR ceph#43284 was merged and the encoding/decoding of
'bal_rank_mask' got in between.  Hence the 'max_xattr_size' is being
encoding/decoded before 'bal_rank_mask'.

URL: https://tracker.ceph.com/issues/55725
Signed-off-by: Luís Henriques <[email protected]>
(cherry picked from commit 7b8def5)
Commit eb915d0 ("cephfs: fix write_buf's _len overflow problem") added
a limit to the total size of xattrs.  This limit is respected by clients
doing a "sync" operation, i.e. MDS_OP_SETXATTR.  However, clients with
CAP_XATTR_EXCL can still buffer these operations and ignore these limits.

This patch prevents clients from crashing the MDSs by also imposing the
xattr limits even when they have the Xx caps.  Replaces the per-MDS knob
"max_xattr_pairs_size" by the new mdsmap setting that the clients can
access.

Unfortunately, clients that misbehave, i.e. old clients that don't respect
this xattrs limit and buffer their xattrs, will see them vanishing.

URL: https://tracker.ceph.com/issues/55725
Signed-off-by: Luís Henriques <[email protected]>
(cherry picked from commit 13e07ff)
When doing a sync setxattr (MDS_OP_SETXATTR) to set the first xattr in an
inode it is possible for the client to set a huge xattr key/value that would
exceed the limit.  Prevent this from from happening by checking the size
against the maximum allowed size.

URL: https://tracker.ceph.com/issues/55725
Signed-off-by: Luís Henriques <[email protected]>
(cherry picked from commit ca1a397)
…p schema

Let the mdsmap schema know about the new field 'max_xattr_size'.  This prevents
the following error:

tasks.mgr.dashboard.helper._ValError: \
  In `input['fs_map']['filesystems'][0]['mdsmap']`: unknown keys: {'max_xattr_size'}

URL: https://tracker.ceph.com/issues/55725
Signed-off-by: Luís Henriques <[email protected]>
(cherry picked from commit bf7ddd8)
…ield

Signed-off-by: Luís Henriques <[email protected]>
(cherry picked from commit b70c752)
@trociny
trociny requested review from a team as code owners September 8, 2023 15:59
@trociny
trociny requested review from Pegonzal and cloudbehl and removed request for a team September 8, 2023 15:59
@trociny trociny added this to the reef milestone Sep 8, 2023
@trociny trociny added the cephfs Ceph File System label Sep 8, 2023
@vshankar
vshankar requested a review from a team October 5, 2023 10:19
@vshankar

Copy link
Copy Markdown
Contributor

Commits are a part of #53340

@vshankar vshankar closed this Oct 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

2 participants