Commit 7fc4da6
ublk: scan partition in async way
Implement async partition scan to avoid IO hang when reading partition
tables. Similar to nvme_partition_scan_work(), partition scanning is
deferred to a work queue to prevent deadlocks.
When partition scan happens synchronously during add_disk(), IO errors
can cause the partition scan to wait while holding ub->mutex, which
can deadlock with other operations that need the mutex.
Changes:
- Add partition_scan_work to ublk_device structure
- Implement ublk_partition_scan_work() to perform async scan
- Always suppress sync partition scan during add_disk()
- Schedule async work after add_disk() for trusted daemons
- Add flush_work() in ublk_stop_dev() before grabbing ub->mutex
Reviewed-by: Caleb Sander Mateos <csander@purestorage.com>
Reported-by: Yoav Cohen <yoav@nvidia.com>
Closes: https://lore.kernel.org/linux-block/DM4PR12MB63280C5637917C071C2F0D65A9A8A@DM4PR12MB6328.namprd12.prod.outlook.com/
Fixes: 71f28f3 ("ublk_drv: add io_uring based userspace block driver")
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>1 parent 04bdb1a commit 7fc4da6
1 file changed
Lines changed: 32 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
237 | 237 | | |
238 | 238 | | |
239 | 239 | | |
| 240 | + | |
240 | 241 | | |
241 | 242 | | |
242 | 243 | | |
| |||
254 | 255 | | |
255 | 256 | | |
256 | 257 | | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
257 | 272 | | |
258 | 273 | | |
259 | 274 | | |
| |||
2026 | 2041 | | |
2027 | 2042 | | |
2028 | 2043 | | |
| 2044 | + | |
2029 | 2045 | | |
2030 | 2046 | | |
2031 | 2047 | | |
| |||
2954 | 2970 | | |
2955 | 2971 | | |
2956 | 2972 | | |
2957 | | - | |
2958 | | - | |
2959 | | - | |
| 2973 | + | |
| 2974 | + | |
| 2975 | + | |
| 2976 | + | |
| 2977 | + | |
| 2978 | + | |
| 2979 | + | |
| 2980 | + | |
| 2981 | + | |
| 2982 | + | |
| 2983 | + | |
2960 | 2984 | | |
2961 | 2985 | | |
2962 | 2986 | | |
| |||
2973 | 2997 | | |
2974 | 2998 | | |
2975 | 2999 | | |
| 3000 | + | |
| 3001 | + | |
| 3002 | + | |
| 3003 | + | |
2976 | 3004 | | |
2977 | 3005 | | |
2978 | 3006 | | |
| |||
3138 | 3166 | | |
3139 | 3167 | | |
3140 | 3168 | | |
| 3169 | + | |
3141 | 3170 | | |
3142 | 3171 | | |
3143 | 3172 | | |
| |||
0 commit comments