mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-08 14:23:19 +00:00
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>
This commit is contained in:
parent
de924abbe7
commit
ab44d7bdee
@ -529,6 +529,15 @@ int bch2_readdir(struct bch_fs *c, subvol_inum inum, struct dir_context *ctx)
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user