diff options
author | Kent Overstreet <kent.overstreet@gmail.com> | 2021-10-22 17:33:38 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2023-10-22 17:09:14 -0400 |
commit | ab44d7bdeebe316a03f37c08c1f66c13ea9aa5d5 (patch) | |
tree | 323168ea374436ab58d6c97f3f07c0f6d83912bb /fs/bcachefs/dirent.c | |
parent | de924abbe7a62bdeb6baaba0f2fe2d1c64ef888b (diff) | |
download | linux-ab44d7bdeebe316a03f37c08c1f66c13ea9aa5d5.tar.gz linux-ab44d7bdeebe316a03f37c08c1f66c13ea9aa5d5.tar.bz2 linux-ab44d7bdeebe316a03f37c08c1f66c13ea9aa5d5.zip |
bcachefs: Fix a transaction path overflow
readdir() in a directory with many subvolumes could overflow transaction
paths - this is a simple hack around the issue.
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com>
Diffstat (limited to 'fs/bcachefs/dirent.c')
-rw-r--r-- | fs/bcachefs/dirent.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/bcachefs/dirent.c b/fs/bcachefs/dirent.c index 2ab9cbaf71f2..6be3ec4ec4a6 100644 --- a/fs/bcachefs/dirent.c +++ b/fs/bcachefs/dirent.c @@ -529,6 +529,15 @@ retry: vfs_d_type(dirent.v->d_type))) break; ctx->pos = dirent.k->p.offset + 1; + + /* + * read_target looks up subvolumes, we can overflow paths if the + * directory has many subvolumes in it + */ + if (hweight64(trans.paths_allocated) > BTREE_ITER_MAX / 2) { + ret = -EINTR; + break; + } } bch2_trans_iter_exit(&trans, &iter); err: |