Commit 1c999c47 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull device mapper fixes from Mike Snitzer:
 "One stable fix for a dm-cache 3.19-rc6 regression and one stable fix
  for dm-thin:

   - fix DM cache metadata open/lookup error paths to properly use
     ERR_PTR and IS_ERR (fixes: 3.19-rc6 "stable" commit 9b1cc9f2)

   - fix DM thin-provisioning to disallow userspace from sending
     messages to the thin-pool if the pool is in READ_ONLY or FAIL mode
     since no metadata changes are allowed in these modes"

* tag 'dm-3.19-fixes-3' of git://git.kernel.org/pub/scm/linux/kernel/git/device-mapper/linux-dm:
  dm thin: don't allow messages to be sent to a pool target in READ_ONLY or FAIL mode
  dm cache: fix missing ERR_PTR returns and handling
parents 353a0c6f 2a7eaea0
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -683,7 +683,7 @@ static struct dm_cache_metadata *metadata_open(struct block_device *bdev,
	cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
	if (!cmd) {
		DMERR("could not allocate metadata struct");
		return NULL;
		return ERR_PTR(-ENOMEM);
	}

	atomic_set(&cmd->ref_count, 1);
@@ -745,7 +745,7 @@ static struct dm_cache_metadata *lookup_or_open(struct block_device *bdev,
		return cmd;

	cmd = metadata_open(bdev, data_block_size, may_format_device, policy_hint_size);
	if (cmd) {
	if (!IS_ERR(cmd)) {
		mutex_lock(&table_lock);
		cmd2 = lookup(bdev);
		if (cmd2) {
@@ -780,9 +780,10 @@ struct dm_cache_metadata *dm_cache_metadata_open(struct block_device *bdev,
{
	struct dm_cache_metadata *cmd = lookup_or_open(bdev, data_block_size,
						       may_format_device, policy_hint_size);
	if (cmd && !same_params(cmd, data_block_size)) {

	if (!IS_ERR(cmd) && !same_params(cmd, data_block_size)) {
		dm_cache_metadata_close(cmd);
		return NULL;
		return ERR_PTR(-EINVAL);
	}

	return cmd;
+6 −0
Original line number Diff line number Diff line
@@ -3385,6 +3385,12 @@ static int pool_message(struct dm_target *ti, unsigned argc, char **argv)
	struct pool_c *pt = ti->private;
	struct pool *pool = pt->pool;

	if (get_pool_mode(pool) >= PM_READ_ONLY) {
		DMERR("%s: unable to service pool target messages in READ_ONLY or FAIL mode",
		      dm_device_name(pool->pool_md));
		return -EINVAL;
	}

	if (!strcasecmp(argv[0], "create_thin"))
		r = process_create_thin_mesg(argc, argv, pool);