From: Joe Thornber Date: Thu, 5 Dec 2013 00:16:11 +0000 (-0500) Subject: dm thin: return error from alloc_data_block if pool is not in write mode X-Git-Tag: firefly_0821_release~176^2~4606^2~27 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=8d30abff758b5f6c71343b7da6bb5de129a76c08;p=firefly-linux-kernel-4.4.55.git dm thin: return error from alloc_data_block if pool is not in write mode Signed-off-by: Joe Thornber Signed-off-by: Mike Snitzer --- 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) 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;