Skip to content

Commit 5d04409

Browse files
author
Kent Overstreet
committed
bcachefs: Always flush write buffer in delete_dead_inodes()
Signed-off-by: Kent Overstreet <[email protected]>
1 parent b6fc661 commit 5d04409

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

fs/bcachefs/inode.c

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,15 @@ int bch2_delete_dead_inodes(struct bch_fs *c)
11811181
bool need_another_pass;
11821182
int ret;
11831183
again:
1184+
/*
1185+
* if we ran check_inodes() unlinked inodes will have already been
1186+
* cleaned up but the write buffer will be out of sync; therefore we
1187+
* alway need a write buffer flush
1188+
*/
1189+
ret = bch2_btree_write_buffer_flush_sync(trans);
1190+
if (ret)
1191+
goto err;
1192+
11841193
need_another_pass = false;
11851194

11861195
/*
@@ -1213,12 +1222,8 @@ int bch2_delete_dead_inodes(struct bch_fs *c)
12131222
ret;
12141223
}));
12151224

1216-
if (!ret && need_another_pass) {
1217-
ret = bch2_btree_write_buffer_flush_sync(trans);
1218-
if (ret)
1219-
goto err;
1225+
if (!ret && need_another_pass)
12201226
goto again;
1221-
}
12221227
err:
12231228
bch2_trans_put(trans);
12241229
return ret;

0 commit comments

Comments
 (0)