Skip to content
/ linux Public

Commit df379f5

Browse files
dagomez137Sasha Levin
authored andcommitted
dm: replace -EEXIST with -EBUSY
[ Upstream commit b13ef36 ] The -EEXIST error code is reserved by the module loading infrastructure to indicate that a module is already loaded. When a module's init function returns -EEXIST, userspace tools like kmod interpret this as "module already loaded" and treat the operation as successful, returning 0 to the user even though the module initialization actually failed. This follows the precedent set by commit 54416fd ("netfilter: conntrack: helper: Replace -EEXIST by -EBUSY") which fixed the same issue in nf_conntrack_helper_register(). Affected modules: * dm_cache dm_clone dm_integrity dm_mirror dm_multipath dm_pcache * dm_vdo dm-ps-round-robin dm_historical_service_time dm_io_affinity * dm_queue_length dm_service_time dm_snapshot Signed-off-by: Daniel Gomez <da.gomez@samsung.com> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent dd18117 commit df379f5

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

drivers/md/dm-exception-store.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ int dm_exception_store_type_register(struct dm_exception_store_type *type)
116116
if (!__find_exception_store_type(type->name))
117117
list_add(&type->list, &_exception_store_types);
118118
else
119-
r = -EEXIST;
119+
r = -EBUSY;
120120
spin_unlock(&_lock);
121121

122122
return r;

drivers/md/dm-log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ int dm_dirty_log_type_register(struct dm_dirty_log_type *type)
121121
if (!__find_dirty_log_type(type->name))
122122
list_add(&type->list, &_log_types);
123123
else
124-
r = -EEXIST;
124+
r = -EBUSY;
125125
spin_unlock(&_lock);
126126

127127
return r;

drivers/md/dm-path-selector.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ int dm_register_path_selector(struct path_selector_type *pst)
107107

108108
if (__find_path_selector_type(pst->name)) {
109109
kfree(psi);
110-
r = -EEXIST;
110+
r = -EBUSY;
111111
} else
112112
list_add(&psi->list, &_path_selectors);
113113

drivers/md/dm-target.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ int dm_register_target(struct target_type *tt)
8888
if (__find_target_type(tt->name)) {
8989
DMERR("%s: '%s' target already registered",
9090
__func__, tt->name);
91-
rv = -EEXIST;
91+
rv = -EBUSY;
9292
} else {
9393
list_add(&tt->list, &_targets);
9494
}

0 commit comments

Comments
 (0)