Commit 659a1d12 authored by Joe Thornber's avatar Joe Thornber Committed by Trond Myklebust

[PATCH] dm: Correct target_type reference counting

ti->use was only getting incremented the first time a target type was
retrieved (bug introduced by recent hch patch).
parent f338ca08
...@@ -43,15 +43,16 @@ static struct tt_internal *get_target_type(const char *name) ...@@ -43,15 +43,16 @@ static struct tt_internal *get_target_type(const char *name)
struct tt_internal *ti; struct tt_internal *ti;
read_lock(&_lock); read_lock(&_lock);
ti = __find_target_type(name); ti = __find_target_type(name);
if (ti && ti->use == 0) { if (ti) {
if (try_module_get(ti->tt.module)) if ((ti->use == 0) && !try_module_get(ti->tt.module))
ti->use++;
else
ti = NULL; ti = NULL;
else
ti->use++;
} }
read_unlock(&_lock);
read_unlock(&_lock);
return ti; return ti;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment