From 2b4bafda16947118b32df52764d745048e2aefed Mon Sep 17 00:00:00 2001 From: Joe Thornber Date: Wed, 4 Dec 2013 19:16:11 -0500 Subject: [PATCH 5/8] 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 --- 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 2a96178..45b10ef 100644 --- a/drivers/md/dm-thin.c +++ b/drivers/md/dm-thin.c @@ -911,6 +911,9 @@ static int alloc_data_block(struct thin_c *tc, dm_block_t *result) unsigned long flags; struct pool *pool = tc->pool; + if (get_pool_mode(pool) != PM_WRITE) + return -EINVAL; + /* * Once no_free_space is set we must not allow allocation to succeed. * Otherwise it is difficult to explain, debug, test and support. -- 1.7.1