mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-04 08:04:24 -04:00
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>
This commit is contained in:
committed by
Kent Overstreet
parent
29c336afeb
commit
a125c0742c
@@ -916,9 +916,7 @@ struct bch_dirent {
|
||||
#define DT_SUBVOL 16
|
||||
#define BCH_DT_MAX 17
|
||||
|
||||
#define BCH_NAME_MAX ((unsigned) (U8_MAX * sizeof(__u64) - \
|
||||
sizeof(struct bkey) - \
|
||||
offsetof(struct bch_dirent, d_name)))
|
||||
#define BCH_NAME_MAX 512
|
||||
|
||||
/* Xattrs */
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user