summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fs/bcachefs/io.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/fs/bcachefs/io.c b/fs/bcachefs/io.c
index 6287b04931ba..c309080c9de0 100644
--- a/fs/bcachefs/io.c
+++ b/fs/bcachefs/io.c
@@ -500,7 +500,8 @@ static void bch2_write_done(struct closure *cl)
bch2_time_stats_update(&c->times[BCH_TIME_data_write], op->start_time);
- up(&c->io_in_flight);
+ if (!(op->flags & BCH_WRITE_FROM_INTERNAL))
+ up(&c->io_in_flight);
if (op->end_io) {
EBUG_ON(cl->parent);
@@ -1260,7 +1261,11 @@ void bch2_write(struct closure *cl)
goto err;
}
- down(&c->io_in_flight);
+ /*
+ * Can't ratelimit copygc - we'd deadlock:
+ */
+ if (!(op->flags & BCH_WRITE_FROM_INTERNAL))
+ down(&c->io_in_flight);
bch2_increment_clock(c, bio_sectors(bio), WRITE);