浏览代码

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>
Joe Thornber 11 年之前
父节点
当前提交
8d30abff75
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      drivers/md/dm-thin.c

+ 3 - 0
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;