dm-ioctl.c (c2b04824620f30b52bb2fdcdd14c758b8c62c70f) dm-ioctl.c (00c4fc3b1f590288cb3c42f36da50f49a513cfcf)
1/*
2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
3 * Copyright (C) 2004 - 2006 Red Hat, Inc. All rights reserved.
4 *
5 * This file is released under the GPL.
6 */
7
8#include "dm.h"

--- 1250 unchanged lines hidden (view full) ---

1259 md = find_device(param);
1260 if (!md)
1261 return -ENXIO;
1262
1263 r = dm_table_create(&t, get_mode(param), param->target_count, md);
1264 if (r)
1265 goto out;
1266
1/*
2 * Copyright (C) 2001, 2002 Sistina Software (UK) Limited.
3 * Copyright (C) 2004 - 2006 Red Hat, Inc. All rights reserved.
4 *
5 * This file is released under the GPL.
6 */
7
8#include "dm.h"

--- 1250 unchanged lines hidden (view full) ---

1259 md = find_device(param);
1260 if (!md)
1261 return -ENXIO;
1262
1263 r = dm_table_create(&t, get_mode(param), param->target_count, md);
1264 if (r)
1265 goto out;
1266
1267 /* Protect md->type and md->queue against concurrent table loads. */
1268 dm_lock_md_type(md);
1267 r = populate_table(t, param, param_size);
1268 if (r) {
1269 dm_table_destroy(t);
1269 r = populate_table(t, param, param_size);
1270 if (r) {
1271 dm_table_destroy(t);
1272 dm_unlock_md_type(md);
1270 goto out;
1271 }
1272
1273 immutable_target_type = dm_get_immutable_target_type(md);
1274 if (immutable_target_type &&
1275 (immutable_target_type != dm_table_get_immutable_target_type(t))) {
1276 DMWARN("can't replace immutable target type %s",
1277 immutable_target_type->name);
1278 dm_table_destroy(t);
1273 goto out;
1274 }
1275
1276 immutable_target_type = dm_get_immutable_target_type(md);
1277 if (immutable_target_type &&
1278 (immutable_target_type != dm_table_get_immutable_target_type(t))) {
1279 DMWARN("can't replace immutable target type %s",
1280 immutable_target_type->name);
1281 dm_table_destroy(t);
1282 dm_unlock_md_type(md);
1279 r = -EINVAL;
1280 goto out;
1281 }
1282
1283 r = -EINVAL;
1284 goto out;
1285 }
1286
1283 /* Protect md->type and md->queue against concurrent table loads. */
1284 dm_lock_md_type(md);
1285 if (dm_get_md_type(md) == DM_TYPE_NONE)
1286 /* Initial table load: acquire type of table. */
1287 dm_set_md_type(md, dm_table_get_type(t));
1288 else if (dm_get_md_type(md) != dm_table_get_type(t)) {
1289 DMWARN("can't change device type after initial table load.");
1290 dm_table_destroy(t);
1291 dm_unlock_md_type(md);
1292 r = -EINVAL;

--- 632 unchanged lines hidden ---
1287 if (dm_get_md_type(md) == DM_TYPE_NONE)
1288 /* Initial table load: acquire type of table. */
1289 dm_set_md_type(md, dm_table_get_type(t));
1290 else if (dm_get_md_type(md) != dm_table_get_type(t)) {
1291 DMWARN("can't change device type after initial table load.");
1292 dm_table_destroy(t);
1293 dm_unlock_md_type(md);
1294 r = -EINVAL;

--- 632 unchanged lines hidden ---