Commit 6c60ff0
block: prevent block device lookups at the beginning of del_gendisk
As an artifact of how gendisk lookup used to work in earlier kernels,
GENHD_FL_UP is only cleared very late in del_gendisk, and a global lock
is used to prevent opens from succeeding while del_gendisk is tearing
down the gendisk. Switch to clearing the flag early and under bd_mutex
so that callers can use bd_mutex to stabilize the flag, which removes
the need for the global mutex.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20210514131842.1600568-2-hch@lst.de
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 9a66e6b commit 6c60ff0
3 files changed
Lines changed: 6 additions & 22 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | | - | |
33 | | - | |
34 | 32 | | |
35 | 33 | | |
36 | 34 | | |
| |||
609 | 607 | | |
610 | 608 | | |
611 | 609 | | |
612 | | - | |
613 | | - | |
614 | | - | |
615 | | - | |
616 | | - | |
617 | | - | |
618 | 610 | | |
| 611 | + | |
619 | 612 | | |
620 | 613 | | |
621 | 614 | | |
| |||
629 | 622 | | |
630 | 623 | | |
631 | 624 | | |
632 | | - | |
633 | | - | |
634 | 625 | | |
635 | 626 | | |
636 | 627 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1298 | 1298 | | |
1299 | 1299 | | |
1300 | 1300 | | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
1301 | 1304 | | |
1302 | 1305 | | |
1303 | 1306 | | |
| |||
1332 | 1335 | | |
1333 | 1336 | | |
1334 | 1337 | | |
1335 | | - | |
1336 | | - | |
| 1338 | + | |
1337 | 1339 | | |
1338 | 1340 | | |
1339 | 1341 | | |
| |||
1364 | 1366 | | |
1365 | 1367 | | |
1366 | 1368 | | |
1367 | | - | |
1368 | 1369 | | |
1369 | 1370 | | |
1370 | | - | |
1371 | 1371 | | |
1372 | | - | |
1373 | | - | |
1374 | 1372 | | |
1375 | 1373 | | |
1376 | | - | |
| 1374 | + | |
1377 | 1375 | | |
1378 | 1376 | | |
1379 | 1377 | | |
| |||
1383 | 1381 | | |
1384 | 1382 | | |
1385 | 1383 | | |
1386 | | - | |
1387 | 1384 | | |
1388 | 1385 | | |
1389 | 1386 | | |
1390 | 1387 | | |
1391 | 1388 | | |
1392 | | - | |
1393 | | - | |
1394 | 1389 | | |
1395 | 1390 | | |
1396 | 1391 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
306 | 306 | | |
307 | 307 | | |
308 | 308 | | |
309 | | - | |
310 | | - | |
311 | 309 | | |
312 | 310 | | |
313 | 311 | | |
| |||
0 commit comments