Skip to contentSkip to conversation

bcachefs: bch2_dir_emit() - fix directory reads in the fuse driver

PATCH Superseded Ariel Miculas 1 participant 1 message May 30, 2024

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 bcachefs: bch2_dir_emit() - fix directory reads in the fuse driver

Commit 0c0cbfdb84725e9933a24ecf47c61bdeeda06ba2 dropped the ctx->pos update before the call to dir_emit. This breaks the userspace implementation, causing the directory reads to be stuck in an infinite loop. This doesn't happen in the kernel because the vfs handles the updates to ctx->pos, but in the fuse implementation nobody updates it.

---
 fs/bcachefs/dirent.c | 1 +
 1 file changed, 1 insertion(+)
fs/bcachefs/dirent.c +1 -0
index c67460d8205d..f1d5ee19e5ea 100644
@@ -534,6 +534,7 @@ int bch2_empty_dir_trans(struct btree_trans *trans, subvol_inum dir)
 static int bch2_dir_emit(struct dir_context *ctx, struct bkey_s_c_dirent d, subvol_inum target)
 {
 	struct qstr name = bch2_dirent_get_name(d);
+	ctx->pos = d.k->p.offset;
 	bool ret = dir_emit(ctx, name.name,
 		      name.len,
 		      target.inum,
Signature · 1 line
2.34.1