mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 17:13:52 +02:00
bcachefs: Fix a race with BCH_WRITE_SKIP_CLOSURE_PUT
Signed-off-by: Kent Overstreet <kent.overstreet@gmail.com> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
This commit is contained in:
parent
74ed7e560b
commit
33e339619f
|
|
@ -1110,6 +1110,16 @@ static void __bch2_write(struct closure *cl)
|
|||
goto flush_io;
|
||||
}
|
||||
|
||||
/*
|
||||
* It's possible for the allocator to fail, put us on the
|
||||
* freelist waitlist, and then succeed in one of various retry
|
||||
* paths: if that happens, we need to disable the skip_put
|
||||
* optimization because otherwise there won't necessarily be a
|
||||
* barrier before we free the bch_write_op:
|
||||
*/
|
||||
if (atomic_read(&cl->remaining) & CLOSURE_WAITING)
|
||||
skip_put = false;
|
||||
|
||||
bch2_open_bucket_get(c, wp, &op->open_buckets);
|
||||
ret = bch2_write_extent(op, wp, &bio);
|
||||
bch2_alloc_sectors_done(c, wp);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user