Skip to content

Commit 3bef882

Browse files
Hou Taogregkh
authored andcommitted
dm thin: stop no_space_timeout worker when switching to write-mode
commit 7529444 upstream. Now both check_for_space() and do_no_space_timeout() will read & write pool->pf.error_if_no_space. If these functions run concurrently, as shown in the following case, the default setting of "queue_if_no_space" can get lost. precondition: * error_if_no_space = false (aka "queue_if_no_space") * pool is in Out-of-Data-Space (OODS) mode * no_space_timeout worker has been queued CPU 0: CPU 1: // delete a thin device process_delete_mesg() // check_for_space() invoked by commit() set_pool_mode(pool, PM_WRITE) pool->pf.error_if_no_space = \ pt->requested_pf.error_if_no_space // timeout, pool is still in OODS mode do_no_space_timeout // "queue_if_no_space" config is lost pool->pf.error_if_no_space = true pool->pf.mode = new_mode Fix it by stopping no_space_timeout worker when switching to write mode. Fixes: bcc696f ("dm thin: stay in out-of-data-space mode once no_space_timeout expires") Cc: [email protected] Signed-off-by: Hou Tao <[email protected]> Signed-off-by: Mike Snitzer <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 4f4b1c5 commit 3bef882

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

drivers/md/dm-thin.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2514,6 +2514,8 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode)
25142514
case PM_WRITE:
25152515
if (old_mode != new_mode)
25162516
notify_of_pool_mode_change(pool, "write");
2517+
if (old_mode == PM_OUT_OF_DATA_SPACE)
2518+
cancel_delayed_work_sync(&pool->no_space_timeout);
25172519
pool->out_of_data_space = false;
25182520
pool->pf.error_if_no_space = pt->requested_pf.error_if_no_space;
25192521
dm_pool_metadata_read_write(pool->pmd);

0 commit comments

Comments
 (0)