hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/md/dm-thin.c
....@@ -2217,6 +2217,7 @@
22172217 throttle_work_update(&pool->throttle);
22182218 dm_pool_issue_prefetches(pool->pmd);
22192219 }
2220
+ cond_resched();
22202221 }
22212222 blk_finish_plug(&plug);
22222223 }
....@@ -2299,6 +2300,7 @@
22992300 else
23002301 pool->process_cell(tc, cell);
23012302 }
2303
+ cond_resched();
23022304 } while (!list_empty(&cells));
23032305 }
23042306
....@@ -2907,6 +2909,8 @@
29072909 dm_bio_prison_destroy(pool->prison);
29082910 dm_kcopyd_client_destroy(pool->copier);
29092911
2912
+ cancel_delayed_work_sync(&pool->waker);
2913
+ cancel_delayed_work_sync(&pool->no_space_timeout);
29102914 if (pool->wq)
29112915 destroy_workqueue(pool->wq);
29122916
....@@ -3379,6 +3383,7 @@
33793383 pt->low_water_blocks = low_water_blocks;
33803384 pt->adjusted_pf = pt->requested_pf = pf;
33813385 ti->num_flush_bios = 1;
3386
+ ti->limit_swap_bios = true;
33823387
33833388 /*
33843389 * Only need to enable discards if the pool should pass
....@@ -3566,20 +3571,28 @@
35663571 */
35673572 r = bind_control_target(pool, ti);
35683573 if (r)
3569
- return r;
3574
+ goto out;
35703575
35713576 r = maybe_resize_data_dev(ti, &need_commit1);
35723577 if (r)
3573
- return r;
3578
+ goto out;
35743579
35753580 r = maybe_resize_metadata_dev(ti, &need_commit2);
35763581 if (r)
3577
- return r;
3582
+ goto out;
35783583
35793584 if (need_commit1 || need_commit2)
35803585 (void) commit(pool);
3586
+out:
3587
+ /*
3588
+ * When a thin-pool is PM_FAIL, it cannot be rebuilt if
3589
+ * bio is in deferred list. Therefore need to return 0
3590
+ * to allow pool_resume() to flush IO.
3591
+ */
3592
+ if (r && get_pool_mode(pool) == PM_FAIL)
3593
+ r = 0;
35813594
3582
- return 0;
3595
+ return r;
35833596 }
35843597
35853598 static void pool_suspend_active_thins(struct pool *pool)
....@@ -4247,6 +4260,7 @@
42474260 goto bad;
42484261
42494262 ti->num_flush_bios = 1;
4263
+ ti->limit_swap_bios = true;
42504264 ti->flush_supported = true;
42514265 ti->per_io_data_size = sizeof(struct dm_thin_endio_hook);
42524266