summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoe Thornber <ejt@redhat.com>2013-12-05 01:16:11 +0100
committerMike Snitzer <snitzer@redhat.com>2014-01-07 16:14:24 +0100
commit8d30abff758b5f6c71343b7da6bb5de129a76c08 (patch)
tree9fdb1fd9d22ad3546f47bdc7151d06779afbe412
parentdm thin: use bool rather than unsigned for flags in structures (diff)
downloadlinux-8d30abff758b5f6c71343b7da6bb5de129a76c08.tar.xz
linux-8d30abff758b5f6c71343b7da6bb5de129a76c08.zip
dm thin: return error from alloc_data_block if pool is not in write mode
Signed-off-by: Joe Thornber <ejt@redhat.com> Signed-off-by: Mike Snitzer <snitzer@redhat.com>
-rw-r--r--drivers/md/dm-thin.c3
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)
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;