diff options
| author | Kent Overstreet <kent.overstreet@linux.dev> | 2025-03-29 23:11:08 -0400 |
|---|---|---|
| committer | Kent Overstreet <kent.overstreet@linux.dev> | 2025-04-02 10:24:34 -0400 |
| commit | dcffc3b1ae3251d796a25c673f614e3099ca83d3 (patch) | |
| tree | 7b5a5ada3f5ca8e5bda8ab38a396f2c3730fd792 /fs/bcachefs/io_read.c | |
| parent | bcachefs: fix ref leak in btree_node_read_all_replicas (diff) | |
| download | linux-dcffc3b1ae3251d796a25c673f614e3099ca83d3.tar.gz linux-dcffc3b1ae3251d796a25c673f614e3099ca83d3.zip | |
bcachefs: Split up bch_dev.io_ref
We now have separate per device io_refs for read and write access.
This fixes a device removal bug where the discard workers were still
running while we're removing alloc info for that device.
It's also a bit of hardening; we no longer allow writes to devices that
are read-only.
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Diffstat (limited to 'fs/bcachefs/io_read.c')
| -rw-r--r-- | fs/bcachefs/io_read.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/fs/bcachefs/io_read.c b/fs/bcachefs/io_read.c index fd01e67b3e84..066670a47886 100644 --- a/fs/bcachefs/io_read.c +++ b/fs/bcachefs/io_read.c @@ -394,7 +394,7 @@ static inline struct bch_read_bio *bch2_rbio_free(struct bch_read_bio *rbio) if (rbio->have_ioref) { struct bch_dev *ca = bch2_dev_have_ref(rbio->c, rbio->pick.ptr.dev); - percpu_ref_put(&ca->io_ref); + percpu_ref_put(&ca->io_ref[READ]); } if (rbio->split) { @@ -1003,7 +1003,7 @@ retry_pick: unlikely(dev_ptr_stale(ca, &pick.ptr))) { read_from_stale_dirty_pointer(trans, ca, k, pick.ptr); bch2_mark_io_failure(failed, &pick, false); - percpu_ref_put(&ca->io_ref); + percpu_ref_put(&ca->io_ref[READ]); goto retry_pick; } @@ -1036,7 +1036,7 @@ retry_pick: */ if (pick.crc.compressed_size > u->op.wbio.bio.bi_iter.bi_size) { if (ca) - percpu_ref_put(&ca->io_ref); + percpu_ref_put(&ca->io_ref[READ]); rbio->ret = -BCH_ERR_data_read_buffer_too_small; goto out_read_done; } |
