diff options
author | Joshua Ashton <joshua@froggi.es> | 2023-08-13 17:53:45 +0200 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 23:10:11 +0200 |
commit | a125c0742ccb0b5f2bc84f3f1a8bcee173c1130d (patch) | |
tree | 615488ba70c349a442edfa6efbf3e0f32fb62d76 /fs/bcachefs/dirent.c | |
parent | bcachefs: Optimize bch2_dirent_name_bytes (diff) | |
download | linux-a125c0742ccb0b5f2bc84f3f1a8bcee173c1130d.tar.xz linux-a125c0742ccb0b5f2bc84f3f1a8bcee173c1130d.zip |
bcachefs: Lower BCH_NAME_MAX to 512
To ensure we aren't shooting ourselves in the foot after merge for
potentially doing future revisions for dirent or for storing multiple
names for casefolding, limit this to 512 for now.
Previously this define was linked to the max size a d_name in
bch_dirent could be.
Signed-off-by: Joshua Ashton <joshua@froggi.es>
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/dirent.c')
-rw-r--r-- | fs/bcachefs/dirent.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/bcachefs/dirent.c b/fs/bcachefs/dirent.c index 6f9eb88c7dba..a7559ab03802 100644 --- a/fs/bcachefs/dirent.c +++ b/fs/bcachefs/dirent.c @@ -115,7 +115,11 @@ int bch2_dirent_invalid(const struct bch_fs *c, struct bkey_s_c k, return -BCH_ERR_invalid_bkey; } - if (d_name.len > BCH_NAME_MAX) { + /* + * Check new keys don't exceed the max length + * (older keys may be larger.) + */ + if ((flags & BKEY_INVALID_COMMIT) && d_name.len > BCH_NAME_MAX) { prt_printf(err, "dirent name too big (%u > %u)", d_name.len, BCH_NAME_MAX); return -BCH_ERR_invalid_bkey; |