From: Joe Thornber <ejt@xxxxxxxxxx> Signed-off-by: Joe Thornber <ejt@xxxxxxxxxx> Signed-off-by: Mike Snitzer <snitzer@xxxxxxxxxx> --- drivers/md/dm-thin.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 70b02fd..b721d7a 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -927,6 +927,9 @@ static int alloc_data_block(struct thin_c *tc, dm_block_t *result) if (pool->no_free_space) return -ENOSPC; + if (get_pool_mode(pool) != PM_WRITE) + return -EINVAL; + r = dm_pool_get_free_block_count(pool->pmd, &free_blocks); if (r) return r; -- 1.8.1.4 -- dm-devel mailing list dm-devel@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/dm-devel