diff options
| author | Hou Tao <houtao1@huawei.com> | 2018-08-02 16:18:24 +0800 |
|---|---|---|
| committer | Mike Snitzer <snitzer@redhat.com> | 2018-08-02 14:06:26 -0400 |
| commit | eff8f4c73dd13f7d53015fc911d66f6671dd82b8 (patch) | |
| tree | b68553298b7dbf2166843200169777f6aacc3b82 | |
| parent | 2ddcd35e2f68e7c7a9ffba1af3fa4829aa917fc8 (diff) | |
| download | linux-dm-eff8f4c73dd13f7d53015fc911d66f6671dd82b8.tar.gz | |
dm thin: stop no_space_timeout worker when switching to write-mode
Notice: this object is not reachable from any branch.
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: bcc696fac11f ("dm thin: stay in out-of-data-space mode once no_space_timeout expires")
Cc: stable@vger.kernel.org
Signed-off-by: Hou Tao <houtao1@huawei.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Notice: this object is not reachable from any branch.
| -rw-r--r-- | drivers/md/dm-thin.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 5997d6808b57a..7bd60a150f8fa 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -2503,6 +2503,8 @@ static void set_pool_mode(struct pool *pool, enum pool_mode new_mode) case PM_WRITE: if (old_mode != new_mode) notify_of_pool_mode_change(pool, "write"); + if (old_mode == PM_OUT_OF_DATA_SPACE) + cancel_delayed_work_sync(&pool->no_space_timeout); pool->out_of_data_space = false; pool->pf.error_if_no_space = pt->requested_pf.error_if_no_space; dm_pool_metadata_read_write(pool->pmd); |
