提交 874d2f61 编写于 作者: M Milan Broz 提交者: Alasdair G Kergon

dm exception store: really fix type lookup

Fix exception store name handling.

We need to reference exception store by zero terminated string.

Fixes regression introduced in commit f6bd4eb7

Cc: Yi Yang <yi.y.yang@intel.com>
Cc: Jonathan Brassow <jbrassow@redhat.com>
Cc: stable@kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: NMilan Broz <mbroz@redhat.com>
Signed-off-by: NAlasdair G Kergon <agk@redhat.com>
上级 5a4f13fa
...@@ -195,7 +195,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv, ...@@ -195,7 +195,7 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
struct dm_exception_store **store) struct dm_exception_store **store)
{ {
int r = 0; int r = 0;
struct dm_exception_store_type *type; struct dm_exception_store_type *type = NULL;
struct dm_exception_store *tmp_store; struct dm_exception_store *tmp_store;
char persistent; char persistent;
...@@ -211,12 +211,15 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv, ...@@ -211,12 +211,15 @@ int dm_exception_store_create(struct dm_target *ti, int argc, char **argv,
} }
persistent = toupper(*argv[1]); persistent = toupper(*argv[1]);
if (persistent != 'P' && persistent != 'N') { if (persistent == 'P')
type = get_type("P");
else if (persistent == 'N')
type = get_type("N");
else {
ti->error = "Persistent flag is not P or N"; ti->error = "Persistent flag is not P or N";
return -EINVAL; return -EINVAL;
} }
type = get_type(&persistent);
if (!type) { if (!type) {
ti->error = "Exception store type not recognised"; ti->error = "Exception store type not recognised";
r = -EINVAL; r = -EINVAL;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册