Commit 2c55559
bcache: Fix bcache device claiming
Commit 2736e8e ("block: use the holder as indication for exclusive
opens") introduced a change that blkdev_put() has to get exclusive
holder of the bdev as an argument. However it overlooked that
register_bdev() and register_cache() overwrite the bdev->bd_holder field
in the block device to point to the real owning object which was not
available at the time we called blkdev_get_by_path(). Messing with bdev
internals like this is a layering violation and it also causes
blkdev_put() to issue warning about mismatching holders.
Fix bcache to reopen the block device with appropriate holder once it is
available which also restores the behavior that multiple bcache caches
cannot claim the same device which was broken by commit 29499ab
("bcache: don't pass a stack address to blkdev_get_by_path").
Fixes: 2736e8e ("block: use the holder as indication for exclusive opens")
Signed-off-by: Jan Kara <jack@suse.cz>
Reviewed-by: Kent Overstreet <kent.overstreet@linux.dev>
Acked-by: Coly Li <colyli@suse.de>
Link: https://lore.kernel.org/r/20230622164658.12861-2-jack@suse.cz
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent abcc0cb commit 2c55559
1 file changed
Lines changed: 38 additions & 27 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1369 | 1369 | | |
1370 | 1370 | | |
1371 | 1371 | | |
1372 | | - | |
| 1372 | + | |
1373 | 1373 | | |
1374 | 1374 | | |
1375 | 1375 | | |
| |||
1453 | 1453 | | |
1454 | 1454 | | |
1455 | 1455 | | |
1456 | | - | |
1457 | 1456 | | |
1458 | 1457 | | |
1459 | 1458 | | |
| |||
2218 | 2217 | | |
2219 | 2218 | | |
2220 | 2219 | | |
2221 | | - | |
| 2220 | + | |
2222 | 2221 | | |
2223 | 2222 | | |
2224 | 2223 | | |
| |||
2345 | 2344 | | |
2346 | 2345 | | |
2347 | 2346 | | |
2348 | | - | |
2349 | 2347 | | |
2350 | 2348 | | |
2351 | 2349 | | |
| |||
2359 | 2357 | | |
2360 | 2358 | | |
2361 | 2359 | | |
2362 | | - | |
| 2360 | + | |
2363 | 2361 | | |
2364 | 2362 | | |
2365 | 2363 | | |
| |||
2516 | 2514 | | |
2517 | 2515 | | |
2518 | 2516 | | |
2519 | | - | |
2520 | | - | |
| 2517 | + | |
| 2518 | + | |
2521 | 2519 | | |
2522 | 2520 | | |
| 2521 | + | |
2523 | 2522 | | |
2524 | 2523 | | |
2525 | 2524 | | |
| |||
2548 | 2547 | | |
2549 | 2548 | | |
2550 | 2549 | | |
2551 | | - | |
2552 | | - | |
2553 | | - | |
2554 | | - | |
2555 | | - | |
2556 | | - | |
2557 | | - | |
2558 | | - | |
2559 | | - | |
2560 | | - | |
2561 | | - | |
2562 | | - | |
2563 | | - | |
2564 | | - | |
2565 | | - | |
2566 | | - | |
| 2550 | + | |
| 2551 | + | |
2567 | 2552 | | |
2568 | | - | |
2569 | 2553 | | |
2570 | 2554 | | |
2571 | 2555 | | |
| |||
2582 | 2566 | | |
2583 | 2567 | | |
2584 | 2568 | | |
| 2569 | + | |
| 2570 | + | |
| 2571 | + | |
| 2572 | + | |
| 2573 | + | |
| 2574 | + | |
| 2575 | + | |
| 2576 | + | |
| 2577 | + | |
| 2578 | + | |
| 2579 | + | |
| 2580 | + | |
| 2581 | + | |
| 2582 | + | |
| 2583 | + | |
| 2584 | + | |
| 2585 | + | |
| 2586 | + | |
| 2587 | + | |
| 2588 | + | |
| 2589 | + | |
| 2590 | + | |
| 2591 | + | |
| 2592 | + | |
| 2593 | + | |
| 2594 | + | |
2585 | 2595 | | |
2586 | 2596 | | |
2587 | 2597 | | |
| |||
2619 | 2629 | | |
2620 | 2630 | | |
2621 | 2631 | | |
2622 | | - | |
2623 | 2632 | | |
2624 | 2633 | | |
2625 | 2634 | | |
| |||
2631 | 2640 | | |
2632 | 2641 | | |
2633 | 2642 | | |
2634 | | - | |
| 2643 | + | |
| 2644 | + | |
2635 | 2645 | | |
2636 | 2646 | | |
2637 | 2647 | | |
| |||
2640 | 2650 | | |
2641 | 2651 | | |
2642 | 2652 | | |
2643 | | - | |
| 2653 | + | |
| 2654 | + | |
2644 | 2655 | | |
2645 | 2656 | | |
2646 | 2657 | | |
| |||
0 commit comments