diff options
-rw-r--r-- | drivers/md/dm-thin.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/md/dm-thin.c b/drivers/md/dm-thin.c index 5f1b11e45702..1988019df5c9 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c | |||
@@ -923,6 +923,9 @@ static int alloc_data_block(struct thin_c *tc, dm_block_t *result) | |||
923 | if (pool->no_free_space) | 923 | if (pool->no_free_space) |
924 | return -ENOSPC; | 924 | return -ENOSPC; |
925 | 925 | ||
926 | if (get_pool_mode(pool) != PM_WRITE) | ||
927 | return -EINVAL; | ||
928 | |||
926 | r = dm_pool_get_free_block_count(pool->pmd, &free_blocks); | 929 | r = dm_pool_get_free_block_count(pool->pmd, &free_blocks); |
927 | if (r) | 930 | if (r) |
928 | return r; | 931 | return r; |